Struct bytecodec::Eos
[−]
[src]
pub struct Eos(_);
Eos contains information on the distance to the end of a stream.
Methods
impl Eos[src]
pub fn new(is_eos_reached: bool) -> Self[src]
Makes a new Eos instance.
pub fn with_remaining_bytes(n: ByteCount) -> Self[src]
Makes a new Eos instance that
has the given information about the number of remaining bytes in a stream.
pub fn is_reached(&self) -> bool[src]
Returns true if the target stream has reached to the end, otherwise false.
pub fn remaining_bytes(&self) -> ByteCount[src]
Returns the information about the number of bytes remaining in the target stream.
pub fn back(&self, bytes: u64) -> Self[src]
Returns a new Eos instance that has moved backward from
the end of the target stream by the specified number of bytes.
Examples
use bytecodec::{ByteCount, Eos}; let eos = Eos::new(true); assert_eq!(eos.is_reached(), true); assert_eq!(eos.remaining_bytes(), ByteCount::Finite(0)); let eos = eos.back(5); assert_eq!(eos.is_reached(), false); assert_eq!(eos.remaining_bytes(), ByteCount::Finite(5));
Trait Implementations
impl Debug for Eos[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Clone for Eos[src]
fn clone(&self) -> Eos[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for Eos[src]
impl PartialEq for Eos[src]
fn eq(&self, __arg_0: &Eos) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Eos) -> bool[src]
This method tests for !=.
impl Eq for Eos[src]
impl Hash for Eos[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl PartialOrd for Eos[src]
fn partial_cmp(&self, __arg_0: &Eos) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, __arg_0: &Eos) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, __arg_0: &Eos) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, __arg_0: &Eos) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, __arg_0: &Eos) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more