parent
322aa41ad6
commit
759d136fe6
2 changed files with 13 additions and 8 deletions
|
@ -1,8 +1,9 @@
|
|||
//! A list element that can be used to render a large number of differently sized elements
|
||||
//! efficiently. Clients of this API need to ensure that elements outside of the scrolled
|
||||
//! area do not change their height for this element to function correctly. In order to minimize
|
||||
//! re-renders, this element's state is stored intrusively on your own views, so that your code
|
||||
//! can coordinate directly with the list element's cached state.
|
||||
//! area do not change their height for this element to function correctly. If your elements
|
||||
//! do change height, notify the list element via [`ListState::splice`] or [`ListState::reset`].
|
||||
//! In order to minimize re-renders, this element's state is stored intrusively
|
||||
//! on your own views, so that your code can coordinate directly with the list element's cached state.
|
||||
//!
|
||||
//! If all of your elements are the same height, see [`UniformList`] for a simpler API
|
||||
|
||||
|
|
|
@ -1023,7 +1023,7 @@ impl SshRemoteClient {
|
|||
server_cx.update(|cx| ChannelClient::new(incoming_rx, outgoing_tx, cx, "fake-server"));
|
||||
let connection: Arc<dyn RemoteConnection> = Arc::new(fake::FakeRemoteConnection {
|
||||
connection_options: opts.clone(),
|
||||
server_cx: fake::SendableCx::new(server_cx.to_async()),
|
||||
server_cx: fake::SendableCx::new(server_cx),
|
||||
server_channel: server_client.clone(),
|
||||
});
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ mod fake {
|
|||
},
|
||||
select_biased, FutureExt, SinkExt, StreamExt,
|
||||
};
|
||||
use gpui::{AsyncAppContext, Task};
|
||||
use gpui::{AsyncAppContext, Task, TestAppContext};
|
||||
use rpc::proto::Envelope;
|
||||
|
||||
use super::{
|
||||
|
@ -2266,15 +2266,19 @@ mod fake {
|
|||
}
|
||||
|
||||
pub(super) struct SendableCx(AsyncAppContext);
|
||||
// safety: you can only get the other cx on the main thread.
|
||||
impl SendableCx {
|
||||
pub(super) fn new(cx: AsyncAppContext) -> Self {
|
||||
Self(cx)
|
||||
// SAFETY: When run in test mode, GPUI is always single threaded.
|
||||
pub(super) fn new(cx: &TestAppContext) -> Self {
|
||||
Self(cx.to_async())
|
||||
}
|
||||
|
||||
// SAFETY: Enforce that we're on the main thread by requiring a valid AsyncAppContext
|
||||
fn get(&self, _: &AsyncAppContext) -> AsyncAppContext {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
// SAFETY: There is no way to access a SendableCx from a different thread, see [`SendableCx::new`] and [`SendableCx::get`]
|
||||
unsafe impl Send for SendableCx {}
|
||||
unsafe impl Sync for SendableCx {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue