Struct lexical_util::iterator::Bytes
source · pub struct Bytes<'a, const FORMAT: u128> { /* private fields */ }
Expand description
Slice iterator that skips characters matching a given value.
This wraps an iterator over a contiguous block of memory, and only returns values that are not equal to skip.
The format allows us to dictate the actual behavior of the iterator: in what contexts does it skip digit separators.
FORMAT
is required to tell us what the digit separator is, and where
the digit separators are allowed, as well tell us the radix.
The radix is required to allow us to differentiate digit from
non-digit characters (see DigitSeparators
for a detailed explanation on why).
Implementations§
source§impl<'a, const FORMAT: u128> Bytes<'a, FORMAT>
impl<'a, const FORMAT: u128> Bytes<'a, FORMAT>
sourcepub const IS_CONTIGUOUS: bool = _
pub const IS_CONTIGUOUS: bool = _
If each yielded value is adjacent in memory.
sourcepub unsafe fn set_cursor(&mut self, index: usize)
pub unsafe fn set_cursor(&mut self, index: usize)
sourcepub fn current_count(&self) -> usize
pub fn current_count(&self) -> usize
Get the current number of values returned by the iterator.
sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Get if the buffer underlying the iterator is empty.
This might not be the same thing as is_consumed
: is_consumed
checks if any more elements may be returned, which may require
peeking the next value. Consumed merely checks if the
iterator has an empty slice. It is effectively a cheaper,
but weaker variant of is_consumed()
.
pub fn is_contiguous(&self) -> bool
sourcepub unsafe fn read_unchecked<V>(&self) -> V
pub unsafe fn read_unchecked<V>(&self) -> V
Read a value of a difference type from the iterator. This advances the internal state of the iterator.
§Safety
Safe as long as the number of the buffer is contains as least as many bytes as the size of V.
sourcepub fn read<V>(&self) -> Option<V>
pub fn read<V>(&self) -> Option<V>
Try to read a value of a different type from the iterator. This advances the internal state of the iterator.
sourcepub fn case_insensitive_first_is(&mut self, value: u8) -> bool
pub fn case_insensitive_first_is(&mut self, value: u8) -> bool
Check if the next element is a given value without case sensitivity.
sourcepub fn integer_iter<'b>(&'b mut self) -> IntegerBytesIterator<'a, 'b, FORMAT>
pub fn integer_iter<'b>(&'b mut self) -> IntegerBytesIterator<'a, 'b, FORMAT>
Get iterator over integer digits.
sourcepub fn fraction_iter<'b>(&'b mut self) -> FractionBytesIterator<'a, 'b, FORMAT>
pub fn fraction_iter<'b>(&'b mut self) -> FractionBytesIterator<'a, 'b, FORMAT>
Get iterator over fraction digits.
sourcepub fn exponent_iter<'b>(&'b mut self) -> ExponentBytesIterator<'a, 'b, FORMAT>
pub fn exponent_iter<'b>(&'b mut self) -> ExponentBytesIterator<'a, 'b, FORMAT>
Get iterator over exponent digits.
sourcepub fn special_iter<'b>(&'b mut self) -> SpecialBytesIterator<'a, 'b, FORMAT>
pub fn special_iter<'b>(&'b mut self) -> SpecialBytesIterator<'a, 'b, FORMAT>
Get iterator over special floating point values.
sourcepub unsafe fn step_by_unchecked(&mut self, count: usize)
pub unsafe fn step_by_unchecked(&mut self, count: usize)
Advance the byte by N
elements.
§Safety
As long as the iterator is at least N
elements, this
is safe.
sourcepub unsafe fn step_unchecked(&mut self)
pub unsafe fn step_unchecked(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl<'a, const FORMAT: u128> Freeze for Bytes<'a, FORMAT>
impl<'a, const FORMAT: u128> RefUnwindSafe for Bytes<'a, FORMAT>
impl<'a, const FORMAT: u128> Send for Bytes<'a, FORMAT>
impl<'a, const FORMAT: u128> Sync for Bytes<'a, FORMAT>
impl<'a, const FORMAT: u128> Unpin for Bytes<'a, FORMAT>
impl<'a, const FORMAT: u128> UnwindSafe for Bytes<'a, FORMAT>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)