Struct web_socket::server::Data
source · pub struct Data<'a, Stream> {
pub ty: DataType,
/* private fields */
}Expand description
It represent a single websocket message.
Fields§
§ty: DataTypeA DataType value indicating the type of the data.
Implementations§
source§impl<RW: Unpin + AsyncBufRead + AsyncWrite> Data<'_, RW>
impl<RW: Unpin + AsyncBufRead + AsyncWrite> Data<'_, RW>
sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read.
sourcepub async fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
pub async fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill buf.
sourcepub async fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<()>
pub async fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<()>
It is a wrapper around the Self::read_to_end_with_limit function with a default limit of 16 MB.