Skip to main content

StringPosition

Trait StringPosition 

Source
pub trait StringPosition:
    Debug
    + Display
    + Clone
    + Copy
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Default
    + Hash
    + Add<Output = Self>
    + AddAssign
    + Sub<Output = Self>
    + SubAssign
    + Sealed
    + CondSerialize
    + 'static {
    const KIND: PositionKind;

    // Required methods
    fn from_other<P: StringPosition>(p: P, source: &str) -> Self;
    fn len(s: &str) -> Self;
    fn inc_offset_by(&mut self, text: &str);
    fn inc_by(&mut self, c: char);
    fn inc_newline(&mut self, crlf: bool);

    // Provided methods
    fn from_many<P: StringPosition>(
        source: &str,
    ) -> PositionConverter<'_, P, Self> { ... }
    fn into_other<P: StringPosition>(self, source: &str) -> P { ... }
    fn into_many<P: StringPosition>(
        source: &str,
    ) -> PositionConverter<'_, Self, P> { ... }
    fn get_range(start: Self, end: Self, text: &str) -> Option<&str> { ... }
}

Required Associated Constantsยง

Required Methodsยง

Source

fn from_other<P: StringPosition>(p: P, source: &str) -> Self

Source

fn len(s: &str) -> Self

Source

fn inc_offset_by(&mut self, text: &str)

Source

fn inc_by(&mut self, c: char)

Source

fn inc_newline(&mut self, crlf: bool)

Provided Methodsยง

Source

fn from_many<P: StringPosition>(source: &str) -> PositionConverter<'_, P, Self>

Source

fn into_other<P: StringPosition>(self, source: &str) -> P

Source

fn into_many<P: StringPosition>(source: &str) -> PositionConverter<'_, Self, P>

Source

fn get_range(start: Self, end: Self, text: &str) -> Option<&str>

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementorsยง