pub struct ConnectInfo(pub ConnectionInfo);Expand description
Extractor for connection metadata.
Provides detailed information about the connection, including:
- Connection ID
- Client socket address
- Connection timestamp
- Protocol information
§Examples
§Logging Connection Info
use wsforge::prelude::*;
async fn handler(ConnectInfo(info): ConnectInfo) -> Result<String> {
println!("Connection {} from {} at {}",
info.id, info.addr, info.connected_at);
Ok("Connected".to_string())
}Tuple Fields§
§0: ConnectionInfoTrait Implementations§
Source§impl FromMessage for ConnectInfo
impl FromMessage for ConnectInfo
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 ConnectInfo
impl RefUnwindSafe for ConnectInfo
impl Send for ConnectInfo
impl Sync for ConnectInfo
impl Unpin for ConnectInfo
impl UnwindSafe for ConnectInfo
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