pub struct Framer<TRng, TWebSocketType>where
TRng: RngCore,
TWebSocketType: WebSocketType,{ /* private fields */ }
Implementations§
Source§impl<TRng> Framer<TRng, Client>where
TRng: RngCore,
impl<TRng> Framer<TRng, Client>where
TRng: RngCore,
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>>
Source§impl<TRng, TWebSocketType> Framer<TRng, TWebSocketType>where
TRng: RngCore,
TWebSocketType: WebSocketType,
impl<TRng, TWebSocketType> Framer<TRng, TWebSocketType>where
TRng: RngCore,
TWebSocketType: WebSocketType,
pub fn new(websocket: WebSocket<TRng, TWebSocketType>) -> Self
pub fn encode<E>( &mut self, message_type: WebSocketSendMessageType, end_of_message: bool, from: &[u8], to: &mut [u8], ) -> Result<usize, FramerError<E>>
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,
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,
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>
impl<TRng, TWebSocketType> Sync for Framer<TRng, TWebSocketType>
impl<TRng, TWebSocketType> Unpin for Framer<TRng, TWebSocketType>
impl<TRng, TWebSocketType> UnwindSafe for Framer<TRng, TWebSocketType>where
TRng: UnwindSafe,
TWebSocketType: 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