[−][src]Struct combine::stream::PointerOffset
Newtype around a pointer offset into a slice stream (&[T]
/&str
).
Implementations
impl<T> PointerOffset<T> where
T: ?Sized,
[src]
T: ?Sized,
pub fn new(offset: usize) -> Self
[src]
pub fn translate_position(self, initial_slice: &T) -> usize
[src]
Converts the pointer-based position into an indexed position.
let text = "b"; let err = token('a').easy_parse(text).unwrap_err(); assert_eq!(err.position.0, text.as_ptr() as usize); assert_eq!(err.map_position(|p| p.translate_position(text)).position, 0);
Trait Implementations
impl<T: ?Sized> Clone for PointerOffset<T>
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: ?Sized> Copy for PointerOffset<T>
[src]
impl<T> Debug for PointerOffset<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T: ?Sized> Default for PointerOffset<T>
[src]
impl<T> Display for PointerOffset<T> where
T: ?Sized,
[src]
T: ?Sized,
impl<T: ?Sized> Eq for PointerOffset<T>
[src]
impl<T: ?Sized> Ord for PointerOffset<T>
[src]
pub fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: ?Sized> PartialEq<PointerOffset<T>> for PointerOffset<T>
[src]
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: ?Sized> PartialOrd<PointerOffset<T>> for PointerOffset<T>
[src]
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for PointerOffset<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T: ?Sized> Send for PointerOffset<T> where
T: Send,
[src]
T: Send,
impl<T: ?Sized> Sync for PointerOffset<T> where
T: Sync,
[src]
T: Sync,
impl<T: ?Sized> Unpin for PointerOffset<T> where
T: Unpin,
[src]
T: Unpin,
impl<T: ?Sized> UnwindSafe for PointerOffset<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,