Struct tokio_util::codec::BytesCodec [−][src]
pub struct BytesCodec(_);
Expand description
A simple Decoder
and Encoder
implementation that just ships bytes around.
Example
Turn an AsyncRead
into a stream of Result<
BytesMut
,
Error
>
.
use tokio::fs::File;
use tokio::io::AsyncRead;
use tokio_util::codec::{FramedRead, BytesCodec};
let my_async_read = File::open("filename.txt").await?;
let my_stream_of_bytes = FramedRead::new(my_async_read, BytesCodec::new());
Implementations
Creates a new BytesCodec
for shipping around raw bytes.
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for BytesCodec
impl Send for BytesCodec
impl Sync for BytesCodec
impl Unpin for BytesCodec
impl UnwindSafe for BytesCodec
Blanket Implementations
Mutably borrows from an owned value. Read more