pub struct Connection { /* private fields */ }Expand description
One member’s open socket. The caller writes Connection::next_outgoing
messages to the wire and calls Connection::deliver with what it reads.
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn next_outgoing(&mut self) -> Option<Vec<u8>>
pub async fn next_outgoing(&mut self) -> Option<Vec<u8>>
The next message the room wants written to this socket, or None once
the connection is closed.
Sourcepub async fn deliver(&self, message: &[u8]) -> Result<(), RealtimeError>
pub async fn deliver(&self, message: &[u8]) -> Result<(), RealtimeError>
Feeds a message received from the socket to RoomHandler::on_message.
§Errors
RealtimeError::NotAMember if this member has already left (so a late
or forged frame is dropped), else any error the handler returns.
§Panics
Panics if the room registry lock is poisoned.
Sourcepub async fn close(self) -> Result<(), RealtimeError>
pub async fn close(self) -> Result<(), RealtimeError>
Ends the membership: removes the socket and runs
RoomHandler::on_leave.
§Errors
Propagates any error the handler’s on_leave returns.
§Panics
Panics if the room registry lock is poisoned.
Auto Trait Implementations§
impl !RefUnwindSafe for Connection
impl !UnwindSafe for Connection
impl Freeze for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
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