pub struct Data(pub Vec<u8>);Expand description
Extractor for raw binary data.
Extracts the message payload as raw bytes. Works with both text and binary messages.
§Examples
§Processing Binary Data
use wsforge::prelude::*;
async fn handler(Data(bytes): Data) -> Result<String> {
println!("Received {} bytes", bytes.len());
Ok(format!("Processed {} bytes", bytes.len()))
}Tuple Fields§
§0: Vec<u8>Trait Implementations§
Source§impl FromMessage for Data
impl FromMessage for Data
Source§fn from_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
message: &'life0 Message,
_conn: &'life1 Connection,
_state: &'life2 AppState,
_extensions: &'life3 Extensions,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn from_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
message: &'life0 Message,
_conn: &'life1 Connection,
_state: &'life2 AppState,
_extensions: &'life3 Extensions,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Extracts
Self from the message and context. Read moreAuto Trait Implementations§
impl Freeze for Data
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnwindSafe for Data
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