[][src]Struct combine::stream::PointerOffset

pub struct PointerOffset<T: ?Sized>(pub usize, _);

Newtype around a pointer offset into a slice stream (&[T]/&str).

Methods

impl<T> PointerOffset<T> where
    T: ?Sized
[src]

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]

impl<T: ?Sized> Copy for PointerOffset<T>[src]

impl<T> Debug for PointerOffset<T> where
    T: ?Sized
[src]

impl<T: ?Sized> Default for PointerOffset<T>[src]

impl<T> Display for PointerOffset<T> where
    T: ?Sized
[src]

impl<T: ?Sized> Eq for PointerOffset<T>[src]

impl<T: ?Sized> Ord for PointerOffset<T>[src]

impl<T: ?Sized> PartialEq<PointerOffset<T>> for PointerOffset<T>[src]

impl<T: ?Sized> PartialOrd<PointerOffset<T>> for PointerOffset<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for PointerOffset<T> where
    T: RefUnwindSafe

impl<T: ?Sized> Send for PointerOffset<T> where
    T: Send

impl<T: ?Sized> Sync for PointerOffset<T> where
    T: Sync

impl<T: ?Sized> Unpin for PointerOffset<T> where
    T: Unpin

impl<T: ?Sized> UnwindSafe for PointerOffset<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.