pub struct FrameWriter<W> { /* private fields */ }Expand description
Async frame writer over any AsyncWrite stream.
Implementations§
Source§impl<W: AsyncWrite + Unpin> FrameWriter<W>
impl<W: AsyncWrite + Unpin> FrameWriter<W>
Sourcepub async fn write_frame(&mut self, frame: &Frame) -> Result<(), TransportError>
pub async fn write_frame(&mut self, frame: &Frame) -> Result<(), TransportError>
Write a frame to the stream.
Sourcepub async fn write_data(&mut self, payload: &[u8]) -> Result<(), TransportError>
pub async fn write_data(&mut self, payload: &[u8]) -> Result<(), TransportError>
Write a data frame with the given payload.
Sourcepub async fn write_control(
&mut self,
payload: &[u8],
) -> Result<(), TransportError>
pub async fn write_control( &mut self, payload: &[u8], ) -> Result<(), TransportError>
Write a control frame with the given payload.
Sourcepub async fn write_json<T: Serialize>(
&mut self,
value: &T,
) -> Result<(), TransportError>
pub async fn write_json<T: Serialize>( &mut self, value: &T, ) -> Result<(), TransportError>
Write a JSON-serializable value as a data frame.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consume the writer and return the inner stream.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for FrameWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for FrameWriter<W>where
W: RefUnwindSafe,
impl<W> Send for FrameWriter<W>where
W: Send,
impl<W> Sync for FrameWriter<W>where
W: Sync,
impl<W> Unpin for FrameWriter<W>where
W: Unpin,
impl<W> UnsafeUnpin for FrameWriter<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for FrameWriter<W>where
W: 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