Struct surf_disco::socket::SocketRequest
source · pub struct SocketRequest<E, VER: StaticVersionType> { /* private fields */ }
Implementations§
source§impl<E: Error, VER: StaticVersionType> SocketRequest<E, VER>
impl<E: Error, VER: StaticVersionType> SocketRequest<E, VER>
sourcepub fn header(
self,
key: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Self
pub fn header( self, key: impl Into<HeaderName>, values: impl ToHeaderValues ) -> Self
Set a header on the request.
sourcepub async fn connect<FromServer: DeserializeOwned, ToServer: Serialize + ?Sized>(
self
) -> Result<Connection<FromServer, ToServer, E, VER>, E>
pub async fn connect<FromServer: DeserializeOwned, ToServer: Serialize + ?Sized>( self ) -> Result<Connection<FromServer, ToServer, E, VER>, E>
Start the WebSocket handshake and initiate a connection to the server.
sourcepub async fn subscribe<FromServer: DeserializeOwned>(
self
) -> Result<Connection<FromServer, Unsupported, E, VER>, E>
pub async fn subscribe<FromServer: DeserializeOwned>( self ) -> Result<Connection<FromServer, Unsupported, E, VER>, E>
Initiate a unidirectional connection to the server.
This is equivalent to self.connect()
with the ToServer
message type replaced by
Unsupported, so that you don’t have to specify the type parameter if it isn’t used.
Trait Implementations§
Auto Trait Implementations§
impl<E, VER> Freeze for SocketRequest<E, VER>
impl<E, VER> RefUnwindSafe for SocketRequest<E, VER>
impl<E, VER> Send for SocketRequest<E, VER>
impl<E, VER> Sync for SocketRequest<E, VER>
impl<E, VER> Unpin for SocketRequest<E, VER>
impl<E, VER> UnwindSafe for SocketRequest<E, VER>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more