pub struct Server { /* private fields */ }Expand description
An instance of a Perspective server. Each Server instance is separate,
and does not share perspective_client::Table (or other) data with other
Servers.
Implementations§
Source§impl Server
impl Server
Sourcepub async fn new_session_with_callback<F>(
&self,
send_response: F,
) -> LocalSession
pub async fn new_session_with_callback<F>( &self, send_response: F, ) -> LocalSession
An alternative method for creating a new Session for this
Server, from a callback closure instead of a via a trait.
See Server::new_session for details.
§Arguments
send_response- A function invoked by theServerwhen a response message needs to be sent to theperspective_client::Client.
Sourcepub async fn new_session<F>(&self, session_handler: F) -> LocalSession
pub async fn new_session<F>(&self, session_handler: F) -> LocalSession
Create a Session for this Server, suitable for exactly one
perspective_client::Client (not necessarily in this process). A
Session represents the server-side state of a single
client-to-server connection.
§Arguments
session_handler- An implementor ofSessionHandlerwhich will be invoked by theServerwhen a response message needs to be sent to the [Client]. The response itself should be passed to [Client::handle_response] eventually, though it may-or-may-not be in the same process.
pub fn new_local_client(&self) -> LocalClient
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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