pub struct WebsocketConnection<S> { /* private fields */ }
Implementations§
Source§impl<S> WebsocketConnection<S>
impl<S> WebsocketConnection<S>
Sourcepub async fn new(uri: Uri, socket: S) -> Result<Self>
pub async fn new(uri: Uri, socket: S) -> Result<Self>
Construct a websocket stream to a pre-established connection socket
.
§Errors
Returns an error if the websocket handshake fails.
pub fn poll_read_next( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<ServerOp, WebsocketReadError>>
Sourcepub async fn read_next(&mut self) -> Result<ServerOp, WebsocketReadError>
pub async fn read_next(&mut self) -> Result<ServerOp, WebsocketReadError>
pub fn should_flush(&self) -> bool
pub fn may_enqueue_more_ops(&mut self) -> bool
Sourcepub fn enqueue_write_op(&mut self, item: &ClientOp)
pub fn enqueue_write_op(&mut self, item: &ClientOp)
Enqueue item
to be written.
pub fn poll_flush(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Trait Implementations§
Auto Trait Implementations§
impl<S> !Freeze for WebsocketConnection<S>
impl<S> RefUnwindSafe for WebsocketConnection<S>where
S: RefUnwindSafe,
impl<S> Send for WebsocketConnection<S>where
S: Send,
impl<S> Sync for WebsocketConnection<S>where
S: Sync,
impl<S> Unpin for WebsocketConnection<S>where
S: Unpin,
impl<S> UnwindSafe for WebsocketConnection<S>where
S: UnwindSafe,
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