pub struct BinarySpan<T> { /* private fields */ }
Expand description
Cloned from the crate nom_locate
but with the omission of computing
the line & column number since we don’t care about them in binary protocols,
and they do make using the LocateSpan
slower.
Implementations§
Source§impl<T> BinarySpan<T>
impl<T> BinarySpan<T>
pub const fn new(buffer: T) -> Self
Sourcepub const unsafe fn new_from_raw_offset(offset: usize, fragment: T) -> Self
pub const unsafe fn new_from_raw_offset(offset: usize, fragment: T) -> Self
Similar to new_extra
, but allows overriding offset.
§Safety
This is unsafe, because giving an offset too large may result in undefined behavior, as some methods move back along the fragment assuming any negative index within the offset is valid.
pub const fn new_extra(program: T) -> BinarySpan<T>
pub const fn location_offset(&self) -> usize
pub const fn fragment(&self) -> &T
Trait Implementations§
Source§impl<T: AsBytes> AsBytes for BinarySpan<T>
impl<T: AsBytes> AsBytes for BinarySpan<T>
Source§impl<T, U> AsRef<U> for BinarySpan<&T>
impl<T, U> AsRef<U> for BinarySpan<&T>
Source§impl<T: Clone> Clone for BinarySpan<T>
impl<T: Clone> Clone for BinarySpan<T>
Source§fn clone(&self) -> BinarySpan<T>
fn clone(&self) -> BinarySpan<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<A: Compare<B>, B: Into<BinarySpan<B>>> Compare<B> for BinarySpan<A>
impl<A: Compare<B>, B: Into<BinarySpan<B>>> Compare<B> for BinarySpan<A>
Source§fn compare(&self, t: B) -> CompareResult
fn compare(&self, t: B) -> CompareResult
Compares self to another value for equality
Source§fn compare_no_case(&self, t: B) -> CompareResult
fn compare_no_case(&self, t: B) -> CompareResult
Compares self to another value for equality
independently of the case. Read more
Source§impl<T: Debug> Debug for BinarySpan<T>
impl<T: Debug> Debug for BinarySpan<T>
Source§impl<T> Deref for BinarySpan<T>
impl<T> Deref for BinarySpan<T>
Source§impl<T: AsBytes> From<T> for BinarySpan<T>
impl<T: AsBytes> From<T> for BinarySpan<T>
Source§impl<T> InputIter for BinarySpan<T>where
T: InputIter,
impl<T> InputIter for BinarySpan<T>where
T: InputIter,
Source§type Item = <T as InputIter>::Item
type Item = <T as InputIter>::Item
The current input type is a sequence of that
Item
type. Read moreSource§type Iter = <T as InputIter>::Iter
type Iter = <T as InputIter>::Iter
An iterator over the input type, producing the item and its position
for use with Slice. If we’re iterating over
&str
, the position
corresponds to the byte index of the characterSource§type IterElem = <T as InputIter>::IterElem
type IterElem = <T as InputIter>::IterElem
An iterator over the input type, producing the item
Source§fn iter_indices(&self) -> Self::Iter
fn iter_indices(&self) -> Self::Iter
Returns an iterator over the elements and their byte offsets
Source§fn iter_elements(&self) -> Self::IterElem
fn iter_elements(&self) -> Self::IterElem
Returns an iterator over the elements
Source§impl<T: InputLength> InputLength for BinarySpan<T>
impl<T: InputLength> InputLength for BinarySpan<T>
Source§impl<T> InputTake for BinarySpan<T>
impl<T> InputTake for BinarySpan<T>
Source§impl<T, R> Slice<R> for BinarySpan<T>
impl<T, R> Slice<R> for BinarySpan<T>
impl<T: Copy> Copy for BinarySpan<T>
impl<T: AsBytes + Eq> Eq for BinarySpan<T>
Auto Trait Implementations§
impl<T> Freeze for BinarySpan<T>where
T: Freeze,
impl<T> RefUnwindSafe for BinarySpan<T>where
T: RefUnwindSafe,
impl<T> Send for BinarySpan<T>where
T: Send,
impl<T> Sync for BinarySpan<T>where
T: Sync,
impl<T> Unpin for BinarySpan<T>where
T: Unpin,
impl<T> UnwindSafe for BinarySpan<T>where
T: UnwindSafe,
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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)