Struct chrono::offset::local::tz_info::parser::Cursor

source ·
pub(crate) struct Cursor<'a> {
    remaining: &'a [u8],
    read_count: usize,
}
Expand description

A Cursor contains a slice of a buffer and a read count.

Fields§

§remaining: &'a [u8]

Slice representing the remaining data to be read

§read_count: usize

Number of already read bytes

Implementations§

source§

impl<'a> Cursor<'a>

source

pub(crate) const fn new(remaining: &'a [u8]) -> Self

Construct a new Cursor from remaining data

source

pub(crate) fn peek(&self) -> Option<&u8>

source

pub(crate) const fn remaining(&self) -> &'a [u8]

Returns remaining data

source

pub(crate) const fn is_empty(&self) -> bool

Returns true if data is remaining

source

pub(crate) fn read_be_u32(&mut self) -> Result<u32, Error>

source

pub(crate) fn read_exact(&mut self, count: usize) -> Result<&'a [u8], Error>

Read exactly count bytes, reducing remaining data and incrementing read count

source

pub(crate) fn read_tag(&mut self, tag: &[u8]) -> Result<(), Error>

Read bytes and compare them to the provided tag

source

pub(crate) fn read_optional_tag(&mut self, tag: &[u8]) -> Result<bool, Error>

Read bytes if the remaining data is prefixed by the provided tag

source

pub(crate) fn read_while<F: Fn(&u8) -> bool>( &mut self, f: F, ) -> Result<&'a [u8], Error>

Read bytes as long as the provided predicate is true

source

pub(crate) fn read_int<T: FromStr<Err = ParseIntError>>( &mut self, ) -> Result<T, Error>

source

pub(crate) fn read_until<F: Fn(&u8) -> bool>( &mut self, f: F, ) -> Result<&'a [u8], Error>

Read bytes until the provided predicate is true

Trait Implementations§

source§

impl<'a> Debug for Cursor<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for Cursor<'a>

source§

fn eq(&self, other: &Cursor<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for Cursor<'a>

source§

impl<'a> StructuralPartialEq for Cursor<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Cursor<'a>

§

impl<'a> RefUnwindSafe for Cursor<'a>

§

impl<'a> Send for Cursor<'a>

§

impl<'a> Sync for Cursor<'a>

§

impl<'a> Unpin for Cursor<'a>

§

impl<'a> UnwindSafe for Cursor<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.