pub struct WebsocketStream { /* private fields */ }
Expand description
RFC-6455 Protocol stream
Implementations§
Source§impl WebsocketStream
impl WebsocketStream
Sourcepub fn new(stream: TcpStream, mode: Mode) -> NewResult
pub fn new(stream: TcpStream, mode: Mode) -> NewResult
Attempts to create a new stream in specified mode
Sourcepub fn set_mode(&mut self, mode: Mode) -> SetFdResult
pub fn set_mode(&mut self, mode: Mode) -> SetFdResult
Sets the socket to the specified mode
Sourcepub fn read(&mut self) -> ReadResult
pub fn read(&mut self) -> ReadResult
Attempts to read data from the socket.
If stream is in Mode::Block, this will block forever until data is received
If socket is in Mode::NonBlock and data is available, it will read until a complete message is received. If the buffer has run out, and it is still waiting on the remaining payload, it will adjust the remaining needed in it’s buffer and will adjust on the next call to this function.
Trait Implementations§
Source§impl Clone for WebsocketStream
impl Clone for WebsocketStream
Source§fn clone(&self) -> WebsocketStream
fn clone(&self) -> WebsocketStream
Returns a copy 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 WebsocketStream
impl RefUnwindSafe for WebsocketStream
impl Send for WebsocketStream
impl Sync for WebsocketStream
impl Unpin for WebsocketStream
impl UnwindSafe for WebsocketStream
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