pub struct IOStream<R, W>{ /* private fields */ }
Expand description
A wrapper of the stream with some common methods.
Implementations§
Source§impl<R, W> IOStream<R, W>
impl<R, W> IOStream<R, W>
Sourcepub fn get_addr(&self) -> &SocketAddr
pub fn get_addr(&self) -> &SocketAddr
Get the addr of the client.
Sourcepub fn get_version(&self) -> &str
pub fn get_version(&self) -> &str
Get the version of the client.
Sourcepub async fn send<B: Buf + Send>(
&mut self,
message: &mut B,
) -> Result<(), NetworkError>
pub async fn send<B: Buf + Send>( &mut self, message: &mut B, ) -> Result<(), NetworkError>
Send a message to the client.
Sourcepub async fn recv(&mut self) -> Result<BytesMut, NetworkError>
pub async fn recv(&mut self) -> Result<BytesMut, NetworkError>
Recv a message from the client.
Auto Trait Implementations§
impl<R, W> !Freeze for IOStream<R, W>
impl<R, W> !RefUnwindSafe for IOStream<R, W>
impl<R, W> Send for IOStream<R, W>
impl<R, W> Sync for IOStream<R, W>
impl<R, W> Unpin for IOStream<R, W>
impl<R, W> UnwindSafe for IOStream<R, W>where
R: UnwindSafe,
W: 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