pub struct ConnectedClient<B: Backend = NoBackend> { /* private fields */ }
Expand description
A connected database client.
Implementations§
Source§impl<B: Backend> ConnectedClient<B>
impl<B: Backend> ConnectedClient<B>
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: Api>(
&self,
session: Option<&Session>,
response: &Api::Response,
) -> Result<(), Error>
pub fn send<Api: Api>( &self, session: Option<&Session>, response: &Api::Response, ) -> Result<(), Error>
Sends a custom API response to the client.
Sourcepub async fn client_data(&self) -> LockedClientDataGuard<'_, B::ClientData>
pub async fn client_data(&self) -> LockedClientDataGuard<'_, B::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: FromIterator<Session>>(&self) -> C
pub fn all_sessions<C: FromIterator<Session>>(&self) -> C
Returns a collection of all active Session
s for this client.
Sourcepub async fn set_client_data(&self, data: B::ClientData)
pub async fn set_client_data(&self, data: B::ClientData)
Sets the associated data for this client.
Trait Implementations§
Source§impl<B: Backend> Clone for ConnectedClient<B>
impl<B: Backend> Clone for ConnectedClient<B>
Auto Trait Implementations§
impl<B> Freeze for ConnectedClient<B>
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§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more