Struct Framer

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

Implementations§

Source§

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

Source

pub fn connect<E>( &mut self, stream: &mut impl Stream<E>, websocket_options: &WebSocketOptions<'_>, ) -> Result<Option<WebSocketSubProtocol>, FramerError<E>>

Source§

impl<'a, TRng> Framer<'a, TRng, Server>
where TRng: RngCore,

Source

pub fn accept<E>( &mut self, stream: &mut impl Stream<E>, websocket_context: &WebSocketContext, ) -> Result<(), FramerError<E>>

Source§

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

Source

pub fn new( read_buf: &'a mut [u8], read_cursor: &'a mut usize, write_buf: &'a mut [u8], websocket: &'a mut WebSocket<TRng, TWebSocketType>, ) -> Self

Source

pub fn state(&self) -> WebSocketState

Source

pub fn close<E>( &mut self, stream: &mut impl Stream<E>, close_status: WebSocketCloseStatusCode, status_description: Option<&str>, ) -> Result<(), FramerError<E>>

Source

pub fn write<E>( &mut self, stream: &mut impl Stream<E>, message_type: WebSocketSendMessageType, end_of_message: bool, frame_buf: &[u8], ) -> Result<(), FramerError<E>>

Source

pub fn read<'b, E>( &mut self, stream: &mut impl Stream<E>, frame_buf: &'b mut [u8], ) -> Result<ReadResult<'b>, FramerError<E>>

Auto Trait Implementations§

§

impl<'a, TRng, TWebSocketType> Freeze for Framer<'a, TRng, TWebSocketType>

§

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

§

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

§

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

§

impl<'a, TRng, TWebSocketType> Unpin for Framer<'a, TRng, TWebSocketType>

§

impl<'a, TRng, TWebSocketType> !UnwindSafe for Framer<'a, TRng, TWebSocketType>

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.