Struct Session
pub(super) struct Session {
server: Server,
indications: Sender<Message>,
transactions: Transactions,
blocked: Option<Outgoing>,
}Expand description
The state of a Connection, without the socket.
The methods that send take a send function, which writes a packet to the
socket.
Fields§
§server: Server§indications: Sender<Message>§transactions: Transactions§blocked: Option<Outgoing>A request that waits until the router allows sending again.
Implementations§
§impl Session
impl Session
pub(super) fn new(server: Server, indications: Sender<Message>) -> Self
pub(super) const fn server(&self) -> Server
pub(super) const fn is_blocked(&self) -> bool
pub(super) const fn is_blocked(&self) -> bool
Returns true while a request waits for the router to allow sending.
pub(super) fn send(
&mut self,
outgoing: Outgoing,
send: impl FnOnce(&[u8]) -> Result<()>,
) -> Result<(), Disconnect>
pub(super) fn send( &mut self, outgoing: Outgoing, send: impl FnOnce(&[u8]) -> Result<()>, ) -> Result<(), Disconnect>
Sends a request, or keeps it until the router allows sending again.
§Errors
Returns Disconnect::Hangup if the server is gone.
pub(super) fn resume(
&mut self,
from: Option<Port>,
send: impl FnOnce(&[u8]) -> Result<()>,
) -> Result<(), Disconnect>
pub(super) fn resume( &mut self, from: Option<Port>, send: impl FnOnce(&[u8]) -> Result<()>, ) -> Result<(), Disconnect>
Sends the blocked request again after the server from allows
sending.
§Errors
Returns Disconnect::Hangup if the server is gone.
pub(super) async fn drop_abandoned(&mut self)
pub(super) async fn drop_abandoned(&mut self)
Waits until the caller of the blocked request stops waiting, then drops the request.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
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