Splitter

Enum Splitter 

Source
#[non_exhaustive]
pub enum Splitter<'opt> { DelimiterLine(&'opt str), EnclosingLines(&'opt str), LineIndex(usize), LinePrefix(&'opt str), }
Expand description

Ways of distinguishing front-matter from the rest of the data in some text.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

DelimiterLine(&'opt str)

All lines before the first line matching this text (ignoring leading and trailing whitespace differences) will be treated as front-matter; everything else (excluding this line, as it is discarded) will be returned as data. If no line is found matching this text, then everything will be treated as front-matter.

§

EnclosingLines(&'opt str)

All lines before the second line matching this text (ignoring leading and trailing whitespace differences) will be treated as front-matter (except for the first line if it also matches this text); everything else (excluding the second matched line, as it is discarded) will be returned as data. If there is no second line matching this text, then everything will be treated as front-matter (with the first line possibly removed).

§

LineIndex(usize)

All lines before this line will be treated as front-matter; everything else (including this line) will be returned as data. If there are less lines than specified here, then everything will be treated as front-matter.

§

LinePrefix(&'opt str)

All lines prefixed with this text, up to (and not including) the first line that is not prefixed, will be treated as front-matter; everything else will be returned as data. If no lines are found with this prefix, then everything will be treated as data. Note that the prefix will not be stripped automatically; use Modifier::StripPrefix to explicitly strip the prefix.

Trait Implementations§

Source§

impl<'opt> Debug for Splitter<'opt>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'opt> Freeze for Splitter<'opt>

§

impl<'opt> RefUnwindSafe for Splitter<'opt>

§

impl<'opt> Send for Splitter<'opt>

§

impl<'opt> Sync for Splitter<'opt>

§

impl<'opt> Unpin for Splitter<'opt>

§

impl<'opt> UnwindSafe for Splitter<'opt>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.