pub struct Eos(/* private fields */);
Expand description
Eos
contains information on the distance to the end of a stream.
Implementations§
Source§impl Eos
impl Eos
Sourcepub fn with_remaining_bytes(n: ByteCount) -> Self
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.
Sourcepub fn is_reached(&self) -> bool
pub fn is_reached(&self) -> bool
Returns true
if the target stream has reached to the end, otherwise false
.
Sourcepub fn remaining_bytes(&self) -> ByteCount
pub fn remaining_bytes(&self) -> ByteCount
Returns the information about the number of bytes remaining in the target stream.
Sourcepub fn back(&self, bytes: u64) -> Self
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§
Source§impl PartialOrd for Eos
impl PartialOrd for Eos
impl Copy for Eos
impl Eq for Eos
impl StructuralPartialEq for Eos
Auto Trait Implementations§
impl Freeze for Eos
impl RefUnwindSafe for Eos
impl Send for Eos
impl Sync for Eos
impl Unpin for Eos
impl UnwindSafe for Eos
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more