Struct asynchronous_codec::BytesCodec [−][src]
pub struct BytesCodec;
A simple codec that ships bytes around
Example
use bytes::Bytes; use futures::{SinkExt, TryStreamExt}; use futures::io::Cursor; use asynchronous_codec::{BytesCodec, Framed}; let mut buf = vec![]; // Cursor implements AsyncRead and AsyncWrite let cur = Cursor::new(&mut buf); let mut framed = Framed::new(cur, BytesCodec); framed.send(Bytes::from("Hello World!")).await?; while let Some(bytes) = framed.try_next().await? { dbg!(bytes); }
Trait Implementations
impl Decoder for BytesCodec
[src]
impl Decoder for BytesCodec
[src]