Struct bytecodec::combinator::Slice [−][src]
pub struct Slice<T> { /* fields omitted */ }
Expand description
Combinator for slicing an input/output byte sequence by the specified number of bytes.
This is created by calling {DecodeExt, EncodeExt}::slice
.
Implementations
Returns the number of remaining bytes consumable in this slice.
The inner decoder or encoder will be suspended if the consumable bytes reaches to 0
.
Set the number of remaining bytes consumable in this slice.
Returns true
if the encoder or decoder cannot consume any more bytes, otherwise false
.
To resume its works, it is needed to reset the value of consumable bytes
by calling set_consumable_bytes
method.
Returns a mutable reference to the inner encoder or decoder.
Takes ownership of this instance and returns the inner encoder or decoder.
Trait Implementations
Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more
Tries to start encoding the given item. Read more
Returns true
if there are no items to be encoded in the encoder, otherwise false
. Read more
Returns the number of bytes required to encode all the items in the encoder. Read more
Returns the exact number of bytes required to encode all the items remaining in the encoder.
Auto Trait Implementations
impl<T> RefUnwindSafe for Slice<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Slice<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Encodes the items remaining in the encoder and writes the encoded bytes to the given write buffer. Read more
Encodes the items remaining in the encoder and
writes the encoded bytes to the given write buffer.
If the write buffer is full and the writing cannot be performed,
the given WriteBuf will memorize cx’s Waker
.
This Waker
’s wake
will later be called when the WriteBuf
regains its free space. Read more