pub struct StatefulJsonSocketBuilder<T, S> { /* private fields */ }Expand description
Route builder that carries shared state S and expects a JSON body of type T.
Obtained from JsonSocketBuilder::state or StatefulSocketBuilder::json.
Implementations§
Source§impl<T: DeserializeOwned + Send + 'static, S: Clone + Send + Sync + 'static> StatefulJsonSocketBuilder<T, S>
impl<T: DeserializeOwned + Send + 'static, S: Clone + Send + Sync + 'static> StatefulJsonSocketBuilder<T, S>
Sourcepub fn onconnect<F, Fut, Re>(self, handler: F) -> SocketType
pub fn onconnect<F, Fut, Re>(self, handler: F) -> SocketType
Finalises this route with an async handler that receives (state: S, body: T).
Sourcepub unsafe fn onconnect_sync<F, Re>(self, handler: F) -> SocketType
pub unsafe fn onconnect_sync<F, Re>(self, handler: F) -> SocketType
Finalises this route with a synchronous handler that receives (state: S, body: T).
§Safety
See ServerMechanism::onconnect_sync for the thread-pool safety notes.
Auto Trait Implementations§
impl<T, S> Freeze for StatefulJsonSocketBuilder<T, S>where
S: Freeze,
impl<T, S> RefUnwindSafe for StatefulJsonSocketBuilder<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for StatefulJsonSocketBuilder<T, S>
impl<T, S> Sync for StatefulJsonSocketBuilder<T, S>
impl<T, S> Unpin for StatefulJsonSocketBuilder<T, S>
impl<T, S> UnsafeUnpin for StatefulJsonSocketBuilder<T, S>where
S: UnsafeUnpin,
impl<T, S> UnwindSafe for StatefulJsonSocketBuilder<T, S>where
S: UnwindSafe,
T: 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