Struct distant_core::Session
source · [−]pub struct Session { /* private fields */ }
Expand description
Represents a session with a remote server that can be used to send requests & receive responses
Implementations
sourceimpl Session
impl Session
sourcepub async fn tcp_connect<U>(addr: SocketAddr, codec: U) -> Result<Self> where
U: Codec + Send + 'static,
pub async fn tcp_connect<U>(addr: SocketAddr, codec: U) -> Result<Self> where
U: Codec + Send + 'static,
Connect to a remote TCP server using the provided information
sourcepub async fn tcp_connect_timeout<U>(
addr: SocketAddr,
codec: U,
duration: Duration
) -> Result<Self> where
U: Codec + Send + 'static,
pub async fn tcp_connect_timeout<U>(
addr: SocketAddr,
codec: U,
duration: Duration
) -> Result<Self> where
U: Codec + Send + 'static,
Connect to a remote TCP server, timing out after duration has passed
sourcepub fn into_channel(self) -> SessionChannel
pub fn into_channel(self) -> SessionChannel
Convert into underlying channel
sourceimpl Session
impl Session
sourceimpl Session
impl Session
sourcepub fn initialize<T, U>(transport: Transport<T, U>) -> Result<Self> where
T: DataStream,
U: Codec + Send + 'static,
pub fn initialize<T, U>(transport: Transport<T, U>) -> Result<Self> where
T: DataStream,
U: Codec + Send + 'static,
Initializes a session using the provided transport and no extra details
sourcepub fn initialize_with_details<T, U>(
transport: Transport<T, U>,
details: Option<SessionDetails>
) -> Result<Self> where
T: DataStream,
U: Codec + Send + 'static,
pub fn initialize_with_details<T, U>(
transport: Transport<T, U>,
details: Option<SessionDetails>
) -> Result<Self> where
T: DataStream,
U: Codec + Send + 'static,
Initializes a session using the provided transport and extra details
sourceimpl Session
impl Session
sourcepub fn details(&self) -> Option<&SessionDetails>
pub fn details(&self) -> Option<&SessionDetails>
Returns details about the session, if it has any
sourcepub async fn wait(self) -> Result<(), JoinError>
pub async fn wait(self) -> Result<(), JoinError>
Waits for the session to terminate, which results when the receiving end of the network connection is closed (or the session is shutdown)
sourcepub fn abort(&self)
pub fn abort(&self)
Abort the session’s current connection by forcing its response task to shutdown
sourcepub fn clone_channel(&self) -> SessionChannel
pub fn clone_channel(&self) -> SessionChannel
Clones the underlying channel for requests and returns the cloned instance
Methods from Deref<Target = SessionChannel>
sourcepub async fn mail(&mut self, req: Request) -> Result<Mailbox, TransportError>
pub async fn mail(&mut self, req: Request) -> Result<Mailbox, TransportError>
Sends a request and returns a mailbox that can receive one or more responses, failing if unable to send a request or if the session’s receiving line to the remote server has already been severed
sourcepub async fn send(&mut self, req: Request) -> Result<Response, TransportError>
pub async fn send(&mut self, req: Request) -> Result<Response, TransportError>
Sends a request and waits for a response, failing if unable to send a request or if the session’s receiving line to the remote server has already been severed
sourcepub async fn send_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<Response, TransportError>
pub async fn send_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<Response, TransportError>
Sends a request and waits for a response, timing out after duration has passed
sourcepub async fn fire(&mut self, req: Request) -> Result<(), TransportError>
pub async fn fire(&mut self, req: Request) -> Result<(), TransportError>
Sends a request without waiting for a response; this method is able to be used even if the session’s receiving line to the remote server has been severed
sourcepub async fn fire_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<(), TransportError>
pub async fn fire_timeout(
&mut self,
req: Request,
duration: Duration
) -> Result<(), TransportError>
Sends a request without waiting for a response, timing out after duration has passed
Trait Implementations
sourceimpl Deref for Session
impl Deref for Session
type Target = SessionChannel
type Target = SessionChannel
The resulting type after dereferencing.
Auto Trait Implementations
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more