Skip to main content

WsLink

Struct WsLink 

Source
pub struct WsLink<S> { /* private fields */ }
Expand description

A Link over a WebSocket connection.

Wraps a WebSocketStream and sends each vox payload as a single binary WebSocket frame. The WebSocket protocol preserves message boundaries natively, so no length-prefix framing is needed.

Implementations§

Source§

impl<S> WsLink<S>

Source

pub fn new(stream: WebSocketStream<S>) -> Self

Construct from an already-upgraded WebSocketStream.

Source§

impl<S> WsLink<S>
where S: AsyncRead + AsyncWrite + Unpin + Send + 'static,

Source

pub async fn server(stream: S) -> Result<Self, Error>

Accept a server-side WebSocket handshake over a raw stream.

Trait Implementations§

Source§

type Tx = WsLinkTx

Source§

type Rx = WsLinkRx

Source§

fn split(self) -> (Self::Tx, Self::Rx)

Source§

fn supports_transport_mode(mode: TransportMode) -> bool
where Self: Sized,

Whether this link supports the requested transport mode. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for WsLink<S>

§

impl<S> !RefUnwindSafe for WsLink<S>

§

impl<S> Send for WsLink<S>
where S: Send,

§

impl<S> Sync for WsLink<S>
where S: Sync,

§

impl<S> Unpin for WsLink<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for WsLink<S>
where S: UnsafeUnpin,

§

impl<S> !UnwindSafe for WsLink<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ChannelLiveness for T
where T: MaybeSend + MaybeSync + 'static,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,