Struct Framer

Source
pub struct Framer<TRng, TWebSocketType>
where TRng: RngCore, TWebSocketType: WebSocketType,
{ /* private fields */ }

Implementations§

Source§

impl<TRng> Framer<TRng, Client>
where TRng: RngCore,

Source

pub async fn connect<'a, B, E>( &mut self, stream: &mut (impl Stream<Item = Result<B, E>> + Sink<&'a [u8], Error = E> + Unpin), buffer: &'a mut [u8], websocket_options: &WebSocketOptions<'_>, ) -> Result<Option<WebSocketSubProtocol>, FramerError<E>>
where B: AsRef<[u8]>,

Source§

impl<TRng, TWebSocketType> Framer<TRng, TWebSocketType>
where TRng: RngCore, TWebSocketType: WebSocketType,

Source

pub fn new(websocket: WebSocket<TRng, TWebSocketType>) -> Self

Source

pub fn encode<E>( &mut self, message_type: WebSocketSendMessageType, end_of_message: bool, from: &[u8], to: &mut [u8], ) -> Result<usize, FramerError<E>>

Source

pub async fn write<'b, E>( &mut self, tx: &mut (impl Sink<&'b [u8], Error = E> + Unpin), tx_buf: &'b mut [u8], message_type: WebSocketSendMessageType, end_of_message: bool, frame_buf: &[u8], ) -> Result<(), FramerError<E>>
where E: Debug,

Source

pub async fn close<'b, E>( &mut self, tx: &mut (impl Sink<&'b [u8], Error = E> + Unpin), tx_buf: &'b mut [u8], close_status: WebSocketCloseStatusCode, status_description: Option<&str>, ) -> Result<(), FramerError<E>>
where E: Debug,

Source

pub async fn read<'a, B: Deref<Target = [u8]>, E>( &mut self, stream: &mut (impl Stream<Item = Result<B, E>> + Sink<&'a [u8], Error = E> + Unpin), buffer: &'a mut [u8], ) -> Option<Result<ReadResult<'a>, FramerError<E>>>
where E: Debug,

Auto Trait Implementations§

§

impl<TRng, TWebSocketType> Freeze for Framer<TRng, TWebSocketType>
where TRng: Freeze,

§

impl<TRng, TWebSocketType> RefUnwindSafe for Framer<TRng, TWebSocketType>
where TRng: RefUnwindSafe, TWebSocketType: RefUnwindSafe,

§

impl<TRng, TWebSocketType> Send for Framer<TRng, TWebSocketType>
where TRng: Send, TWebSocketType: Send,

§

impl<TRng, TWebSocketType> Sync for Framer<TRng, TWebSocketType>
where TRng: Sync, TWebSocketType: Sync,

§

impl<TRng, TWebSocketType> Unpin for Framer<TRng, TWebSocketType>
where TRng: Unpin, TWebSocketType: Unpin,

§

impl<TRng, TWebSocketType> UnwindSafe for Framer<TRng, TWebSocketType>
where TRng: UnwindSafe, TWebSocketType: UnwindSafe,

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.