ZIm/crates/collab/src
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
..
bin Introduce a delay before retrying a transaction after a serialization failure 2023-03-16 13:07:38 -07:00
db Add a bit to each entry indicating if it's outside of the worktree root 2023-06-22 10:34:28 -07:00
rpc Use a synchronous mutex for ConnectionPool 2022-12-13 13:50:51 +01:00
tests WIP: Return WindowHandle<V: View> from AppContext::add_window (#2820) 2023-08-03 18:45:51 -06:00
api.rs Create user record automatically when someone logs in on the website 2023-03-14 12:25:04 +01:00
auth.rs Add logging and metric for time spent hashing auth tokens 2023-03-17 14:32:13 -07:00
db.rs chore: Replace lazy_static Mutex with const. (#2693) 2023-07-07 15:07:12 +02:00
env.rs Rename zed-server to collab 2022-04-09 08:30:42 -06:00
errors.rs Remove more unused code related to GitHub auth and errors 2022-04-21 08:57:49 -06:00
executor.rs WIP - Panic immediately when detecting non-determinism via a change to the execution trace 2022-12-23 17:34:13 -08:00
lib.rs Introduce a delay before retrying a transaction after a serialization failure 2023-03-16 13:07:38 -07:00
main.rs Introduce a delay before retrying a transaction after a serialization failure 2023-03-16 13:07:38 -07:00
rpc.rs Forward inlay hint refresh requests to clients, test coop inlay hints 2023-06-29 22:25:49 +03:00
tests.rs Get tests compiling returning WindowHandle<V: View> from add_window 2023-08-02 14:05:03 -06:00