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

pub struct PointerOffset(pub usize);

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

Implementations

impl PointerOffset[src]

pub fn translate_position<T>(self, initial_string: &T) -> usize where
    T: ?Sized
[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 Clone for PointerOffset[src]

impl Copy for PointerOffset[src]

impl Debug for PointerOffset[src]

impl Default for PointerOffset[src]

impl Display for PointerOffset[src]

impl Eq for PointerOffset[src]

impl Ord for PointerOffset[src]

impl PartialEq<PointerOffset> for PointerOffset[src]

impl PartialOrd<PointerOffset> for PointerOffset[src]

impl StructuralEq for PointerOffset[src]

impl StructuralPartialEq for PointerOffset[src]

Auto Trait Implementations

impl RefUnwindSafe for PointerOffset

impl Send for PointerOffset

impl Sync for PointerOffset

impl Unpin for PointerOffset

impl UnwindSafe for PointerOffset

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.