pub struct StatefulSocketBuilder<S> { /* private fields */ }Expand description
Route builder that carries shared state S with no body or query expectation.
Obtained from ServerMechanism::state. S must be Clone + Send + Sync + 'static.
Implementations§
Source§impl<S: Clone + Send + Sync + 'static> StatefulSocketBuilder<S>
impl<S: Clone + Send + Sync + 'static> StatefulSocketBuilder<S>
Sourcepub fn json<T: DeserializeOwned + Send>(self) -> StatefulJsonSocketBuilder<T, S>
pub fn json<T: DeserializeOwned + Send>(self) -> StatefulJsonSocketBuilder<T, S>
Adds a JSON body expectation, transitioning to StatefulJsonSocketBuilder.
Sourcepub fn query<T: DeserializeOwned + Send>(
self,
) -> StatefulQuerySocketBuilder<T, S>
pub fn query<T: DeserializeOwned + Send>( self, ) -> StatefulQuerySocketBuilder<T, S>
Adds a query parameter expectation, transitioning to StatefulQuerySocketBuilder.
Sourcepub fn encryption<T>(
self,
key: SerializationKey,
) -> StatefulEncryptedBodyBuilder<T, S>
pub fn encryption<T>( self, key: SerializationKey, ) -> StatefulEncryptedBodyBuilder<T, S>
Adds an encrypted body expectation, transitioning to StatefulEncryptedBodyBuilder.
Sourcepub fn encrypted_query<T>(
self,
key: SerializationKey,
) -> StatefulEncryptedQueryBuilder<T, S>
pub fn encrypted_query<T>( self, key: SerializationKey, ) -> StatefulEncryptedQueryBuilder<T, S>
Adds an encrypted query expectation, transitioning to StatefulEncryptedQueryBuilder.
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 only the shared state.
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 only the shared state.
§Safety
See ServerMechanism::onconnect_sync for the thread-pool safety notes.
Auto Trait Implementations§
impl<S> Freeze for StatefulSocketBuilder<S>where
S: Freeze,
impl<S> RefUnwindSafe for StatefulSocketBuilder<S>where
S: RefUnwindSafe,
impl<S> Send for StatefulSocketBuilder<S>where
S: Send,
impl<S> Sync for StatefulSocketBuilder<S>where
S: Sync,
impl<S> Unpin for StatefulSocketBuilder<S>where
S: Unpin,
impl<S> UnsafeUnpin for StatefulSocketBuilder<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for StatefulSocketBuilder<S>where
S: 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