Struct bonsaidb::server::ConnectedClient
source · pub struct ConnectedClient<B = NoBackend>where
B: Backend,{ /* private fields */ }
Expand description
A connected database client.
Implementations§
source§impl<B> ConnectedClient<B>where
B: Backend,
impl<B> ConnectedClient<B>where
B: Backend,
sourcepub fn address(&self) -> &SocketAddr
pub fn address(&self) -> &SocketAddr
Returns the address of the connected client.
sourcepub fn transport(&self) -> &Transport
pub fn transport(&self) -> &Transport
Returns the transport method the client is connected via.
sourcepub fn connected(&self) -> bool
pub fn connected(&self) -> bool
Returns true if the server still believes the client is connected.
sourcepub fn send<Api>(
&self,
session: Option<&Session>,
response: &<Api as Api>::Response
) -> Result<(), Error>where
Api: Api,
pub fn send<Api>(
&self,
session: Option<&Session>,
response: &<Api as Api>::Response
) -> Result<(), Error>where
Api: Api,
Sends a custom API response to the client.
sourcepub async fn client_data(
&self
) -> LockedClientDataGuard<'_, <B as Backend>::ClientData>
pub async fn client_data( &self ) -> LockedClientDataGuard<'_, <B as Backend>::ClientData>
Returns a locked reference to the stored client data.
sourcepub fn session(&self, session_id: Option<SessionId>) -> Option<Session>
pub fn session(&self, session_id: Option<SessionId>) -> Option<Session>
Looks up an active authentication session by its unique id. None
represents the unauthenticated session, and the result can be used to
check what permissions are allowed by default.
sourcepub fn all_sessions<C>(&self) -> Cwhere
C: FromIterator<Session>,
pub fn all_sessions<C>(&self) -> Cwhere
C: FromIterator<Session>,
Returns a collection of all active Session
s for this client.
sourcepub async fn set_client_data(&self, data: <B as Backend>::ClientData)
pub async fn set_client_data(&self, data: <B as Backend>::ClientData)
Sets the associated data for this client.
Trait Implementations§
source§impl<B> Clone for ConnectedClient<B>where
B: Backend,
impl<B> Clone for ConnectedClient<B>where
B: Backend,
source§fn clone(&self) -> ConnectedClient<B>
fn clone(&self) -> ConnectedClient<B>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<B = NoBackend> !RefUnwindSafe for ConnectedClient<B>
impl<B> Send for ConnectedClient<B>
impl<B> Sync for ConnectedClient<B>
impl<B> Unpin for ConnectedClient<B>
impl<B = NoBackend> !UnwindSafe for ConnectedClient<B>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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