pub struct MiddlewareContext<S: AppState> {
pub state: Arc<S>,
pub ws_sender: AsyncSender<Message>,
}Expand description
Context information passed to middleware during message processing.
This struct provides middleware with access to the application state and the WebSocket sender channel for sending messages.
Fields§
§state: Arc<S>The shared application state
ws_sender: AsyncSender<Message>The WebSocket sender for outgoing messages
Implementations§
Source§impl<S: AppState> MiddlewareContext<S>
impl<S: AppState> MiddlewareContext<S>
Sourcepub fn new(state: Arc<S>, ws_sender: AsyncSender<Message>) -> Self
pub fn new(state: Arc<S>, ws_sender: AsyncSender<Message>) -> Self
Creates a new middleware context.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for MiddlewareContext<S>
impl<S> !RefUnwindSafe for MiddlewareContext<S>
impl<S> Send for MiddlewareContext<S>
impl<S> Sync for MiddlewareContext<S>
impl<S> Unpin for MiddlewareContext<S>
impl<S> UnsafeUnpin for MiddlewareContext<S>
impl<S> !UnwindSafe for MiddlewareContext<S>
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