Files
oak-gpui/crates
Nathan Sobo d3c1966d96 WIP: Return WindowHandle<V: View> from AppContext::add_window (#2820)
Instead of returning a usize for the window id, I'm instead returning a
`WindowHandle<V: View>` where `V` is the type of the window's root view.
@as-cii helped me with a cool technique using generic associated types
where methods on `WindowHandle` can return either T or Option<T>
depending on the `BorrowWindowContext::Result` associated type.

Some example usage...

```rs
let window = cx.add_window(|cx| MyView::new(cx));
let my_view = window.root(cx); // If cx is TestAppContext, returns MyView. Otherwise returns Option<MyView>, because the window could be closed.
```


This isn't insanely beneficial on its own, but I think it will help
clean up our testing story. I'm planning on making `window` more useful
in tests for laying out elements, etc.

- [x] Rework tests that call `add_window` 😅 to expect only a window in
return.
- [x] Get tests passing
- [x] 🚬  test
2023-08-03 18:45:51 -06:00
..
2023-07-20 16:10:20 -04:00
2023-07-18 12:32:53 -04:00
2023-08-03 17:11:47 -06:00
2023-07-14 16:09:02 -07:00
2023-08-03 17:11:47 -06:00
2023-08-03 17:11:47 -06:00
2023-07-23 21:36:29 -07:00
2023-08-03 17:46:34 -06:00
fmt
2023-07-27 11:14:21 -07:00
WIP
2023-08-03 17:03:39 -06:00
2023-06-02 22:02:19 -04:00
2023-06-02 22:02:19 -04:00
2023-08-03 18:57:43 -04:00
2023-06-29 22:25:49 +03:00
2023-06-29 22:39:33 +03:00
2023-08-03 17:11:47 -06:00
2023-08-01 10:40:38 -04:00
2023-06-02 22:02:19 -04:00
2023-07-27 12:19:07 -04:00
WIP
2023-08-03 17:03:39 -06:00
2023-06-30 22:03:21 +03:00
2023-07-25 11:06:41 -06:00
2023-08-03 18:57:43 -04:00
2023-08-02 09:19:23 -07:00
2023-08-03 17:11:47 -06:00
2023-06-22 18:06:52 +02:00