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