pub struct AsyncSessionEndpoint {
pub remaining: SType,
/* private fields */
}Expand description
An asynchronous session endpoint that buffers outgoing messages.
Unlike SessionEndpoint, sends do not block: they enqueue into a local
outbox. The peer drains the outbox into its inbox when it is ready to
receive, modelling asynchronous / buffered channels.
Fields§
§remaining: STypeThe remaining (un-consumed) session type.
Implementations§
Source§impl AsyncSessionEndpoint
impl AsyncSessionEndpoint
Sourcepub fn async_send(&mut self, msg: Message) -> Result<(), String>
pub fn async_send(&mut self, msg: Message) -> Result<(), String>
Asynchronously send a message (enqueue without blocking).
Sourcepub fn flush_to(&mut self, peer: &mut AsyncSessionEndpoint) -> usize
pub fn flush_to(&mut self, peer: &mut AsyncSessionEndpoint) -> usize
Deliver all outgoing messages into the peer’s inbox. Returns the number of messages flushed.
Sourcepub fn async_recv(&mut self) -> Result<Message, String>
pub fn async_recv(&mut self) -> Result<Message, String>
Receive a message from the inbox (must have been delivered by the peer).
Sourcepub fn outbox_len(&self) -> usize
pub fn outbox_len(&self) -> usize
Number of messages waiting in the outbox (not yet delivered).
Auto Trait Implementations§
impl Freeze for AsyncSessionEndpoint
impl RefUnwindSafe for AsyncSessionEndpoint
impl Send for AsyncSessionEndpoint
impl Sync for AsyncSessionEndpoint
impl Unpin for AsyncSessionEndpoint
impl UnsafeUnpin for AsyncSessionEndpoint
impl UnwindSafe for AsyncSessionEndpoint
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