Skip to main content

Rule

Enum Rule 

Source
pub enum Rule {
Show 24 variants EOI, WHITESPACE, document, block, header, unordered_list, ordered_list, paragraph, paragraph_line, unordered_list_point, ordered_list_point, line_content, bold_italic, bold, italic, not_bold_italic_char, not_bold_char, not_italic_char, char, header_start, unordered_start, ordered_start, digit, new_line,
}

Variants§

§

EOI

End-of-input

§

WHITESPACE

Match one whitespace characters (space or tab).

§

document

A document consists of zero or more blocks from the Start of Input (SOI) to the End of Input (EOI).

§

block

A block is a main structural element. It can be a header, a list, or a paragraph.

§

header

Match a header line. Consists of a header start, content and a new line.

§

unordered_list

Match an unordered list, which consists of one or more list points.

§

ordered_list

Match an ordered list, which consists of one or more numbered list points.

§

paragraph

Match a paragraph, which onsists of one or more lines of text.

§

paragraph_line

A line of a paragraph, which does not start as a header or list.

§

unordered_list_point

A point in an unordered list. Consists of an unordered start, content and a new line.

§

ordered_list_point

A point in an ordered list. Consists of an ordered start, content and a new line.

§

line_content

The content of a line, which can contain bold, italic or bold italic text, as well as plain characters and whitespace.

§

bold_italic

Match bold and italic text(triple asterisks).

§

bold

Match bold text (double asterisks).

§

italic

Match italic text (single asterisk).

§

not_bold_italic_char

Match characters that can appear inside bold italic text, not “***” or newlines.

§

not_bold_char

Match characters that can appear inside bold text, not “**” or newlines.

§

not_italic_char

Match characters that can appear inside italic text, not “*” or newlines.

§

char

Match any character except newline. Basic building block for text content.

§

header_start

Match the start of a header line. Consists of 1 to 6 hash symbols, not followed by another hash and a space/end.

§

unordered_start

Match the start of an unordered list point. Can be a dash or asterisk followed by a space.

§

ordered_start

Match the start of an ordered list point. Consists of one or more digits followed by a period and space.

§

digit

Match a digit character (0-9).

§

new_line

Match a newline character in either windows (\r\n) or unix (\n) format.

Implementations§

Source§

impl Rule

Source

pub fn all_rules() -> &'static [Rule]

Trait Implementations§

Source§

impl Clone for Rule

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Rule

Source§

impl Debug for Rule

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Rule

Source§

impl Hash for Rule

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Rule

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl Parser<Rule> for MarkdownParser

Source§

fn parse<'i>(rule: Rule, input: &'i str) -> Result<Pairs<'i, Rule>, Error<Rule>>

Parses a &str starting from rule.
Source§

impl PartialEq for Rule

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Rule

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Rule

Auto Trait Implementations§

§

impl Freeze for Rule

§

impl RefUnwindSafe for Rule

§

impl Send for Rule

§

impl Sync for Rule

§

impl Unpin for Rule

§

impl UnsafeUnpin for Rule

§

impl UnwindSafe for Rule

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.