[][src]Struct bytecodec::Eos

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 Eq for Eos[src]

impl Clone for Eos[src]

impl PartialOrd<Eos> for Eos[src]

impl PartialEq<Eos> for Eos[src]

impl Copy for Eos[src]

impl Hash for Eos[src]

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]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]