[−][src]Struct bytecodec::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 Eq for Eos
[src]
impl Clone for Eos
[src]
impl PartialOrd<Eos> for Eos
[src]
fn partial_cmp(&self, other: &Eos) -> Option<Ordering>
[src]
fn lt(&self, other: &Eos) -> bool
[src]
fn le(&self, other: &Eos) -> bool
[src]
fn gt(&self, other: &Eos) -> bool
[src]
fn ge(&self, other: &Eos) -> bool
[src]
impl PartialEq<Eos> for Eos
[src]
impl Copy for Eos
[src]
impl Hash for Eos
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Debug for Eos
[src]
Auto Trait Implementations
impl Send for Eos
impl Unpin for Eos
impl Sync for Eos
impl UnwindSafe for Eos
impl RefUnwindSafe for Eos
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,