pub struct SessionHandle { /* private fields */ }Expand description
Cloneable handle for opening and closing virtual connections.
Returned by the session builder alongside the Session and root
ConnectionHandle. The session’s run() loop must be running
concurrently for requests to be processed.
Implementations§
Source§impl SessionHandle
impl SessionHandle
Sourcepub async fn open_connection(
&self,
settings: ConnectionSettings,
metadata: Metadata<'static>,
) -> Result<ConnectionHandle, SessionError>
pub async fn open_connection( &self, settings: ConnectionSettings, metadata: Metadata<'static>, ) -> Result<ConnectionHandle, SessionError>
Open a new virtual connection on the session.
Allocates a connection ID, sends ConnectionOpen to the peer, and
waits for ConnectionAccept or ConnectionReject. The session’s
run() loop processes the response and completes the returned future.
Sourcepub async fn close_connection(
&self,
conn_id: ConnectionId,
metadata: Metadata<'static>,
) -> Result<(), SessionError>
pub async fn close_connection( &self, conn_id: ConnectionId, metadata: Metadata<'static>, ) -> Result<(), SessionError>
Close a virtual connection.
Sends ConnectionClose to the peer and removes the connection slot.
After this returns, no further messages will be routed to the
connection’s driver.
Sourcepub fn shutdown(&self) -> Result<(), SessionError>
pub fn shutdown(&self) -> Result<(), SessionError>
Request shutdown of the entire session (root + all virtual connections).
Trait Implementations§
Source§impl Clone for SessionHandle
impl Clone for SessionHandle
Source§fn clone(&self) -> SessionHandle
fn clone(&self) -> SessionHandle
Returns a duplicate 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 Freeze for SessionHandle
impl RefUnwindSafe for SessionHandle
impl Send for SessionHandle
impl Sync for SessionHandle
impl Unpin for SessionHandle
impl UnsafeUnpin for SessionHandle
impl UnwindSafe for SessionHandle
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