pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
pub fn new(http: Arc<dyn HttpClient>, cx: &AppContext) -> Arc<Self>
pub fn id(&self) -> u64
pub fn http_client(&self) -> Arc<dyn HttpClient>
pub fn set_id(&self, id: u64) -> &Self
pub fn user_id(&self) -> Option<u64>
pub fn peer_id(&self) -> Option<PeerId>
pub fn status(&self) -> Receiver<Status>
pub fn subscribe_to_entity<T>( self: &Arc<Self>, remote_id: u64 ) -> Result<PendingEntitySubscription<T>>where T: 'static,
pub fn add_message_handler<M, E, H, F>( self: &Arc<Self>, entity: WeakModel<E>, handler: H ) -> Subscriptionwhere M: EnvelopedMessage, E: 'static, H: 'static + Sync + Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F + Send, F: 'static + Future<Output = Result<()>>,
pub fn add_request_handler<M, E, H, F>( self: &Arc<Self>, model: WeakModel<E>, handler: H ) -> Subscriptionwhere M: RequestMessage, E: 'static, H: 'static + Sync + Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F + Send, F: 'static + Future<Output = Result<M::Response>>,
pub fn add_model_message_handler<M, E, H, F>(self: &Arc<Self>, handler: H)where M: EntityMessage, E: 'static, H: 'static + Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F + Send + Sync, F: 'static + Future<Output = Result<()>>,
pub fn add_model_request_handler<M, E, H, F>(self: &Arc<Self>, handler: H)where M: EntityMessage + RequestMessage, E: 'static, H: 'static + Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F + Send + Sync, F: 'static + Future<Output = Result<M::Response>>,
pub async fn has_keychain_credentials(&self, cx: &AsyncAppContext) -> bool
pub fn authenticate_and_connect<'life0, 'life1, 'async_recursion>( self: &'life0 Arc<Self>, try_keychain: bool, cx: &'life1 AsyncAppContext ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_recursion>>where 'life0: 'async_recursion, 'life1: 'async_recursion,
pub fn authenticate_with_browser( self: &Arc<Self>, cx: &AsyncAppContext ) -> Task<Result<Credentials>>
pub fn disconnect(self: &Arc<Self>, cx: &AsyncAppContext)
pub fn reconnect(self: &Arc<Self>, cx: &AsyncAppContext)
pub fn send<T: EnvelopedMessage>(&self, message: T) -> Result<()>
pub fn request<T: RequestMessage>( &self, request: T ) -> impl Future<Output = Result<T::Response>>
pub fn request_envelope<T: RequestMessage>( &self, request: T ) -> impl Future<Output = Result<TypedEnvelope<T::Response>>>
pub fn telemetry(&self) -> &Arc<Telemetry>
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more