layoutcss_parser::parser

Struct Parser

Source
pub struct Parser<'a> {
    pub state: State,
    pub text: &'a str,
    pub tag_name_start: Option<usize>,
    pub tag_name_end: Option<usize>,
    pub attribute_name_start: Option<usize>,
    pub attribute_name_end: Option<usize>,
    pub layout_attribute_value_start: Option<usize>,
    pub layout_attribute_value_end: Option<usize>,
    pub layout_breakpoint_attribute_value_start: Option<usize>,
    pub layout_breakpoint_attribute_value_end: Option<usize>,
    pub biggest_breakpoint: Option<usize>,
    pub biggest_breakpoint_value: Option<&'a str>,
}

Fields§

§state: State§text: &'a str§tag_name_start: Option<usize>§tag_name_end: Option<usize>§attribute_name_start: Option<usize>§attribute_name_end: Option<usize>§layout_attribute_value_start: Option<usize>§layout_attribute_value_end: Option<usize>§layout_breakpoint_attribute_value_start: Option<usize>§layout_breakpoint_attribute_value_end: Option<usize>§biggest_breakpoint: Option<usize>§biggest_breakpoint_value: Option<&'a str>

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub fn new(text: &'a str) -> Self

Source

pub fn reset_indexes(&mut self)

Source

pub fn tag_name(&self) -> Option<&'a str>

Source

pub fn tag_name_new(&self) -> &'a str

Source

pub fn attribute_name(&self) -> Option<&'a str>

Source

pub fn layout_attribute_value(&self) -> Option<&'a str>

Source

pub fn layout_breakpoint_attribute_value(&self) -> Option<&'a str>

Source

pub fn update_biggest_breakpoint(&mut self, breakpoint: usize) -> bool

update the biggest_breakpoint of the parser only if the new breakpoint is superior to the one of the parser or if the parser has None as biggest_breakpoint

Source

pub fn transition(&self, c: char) -> Option<State>

return the new state of the parser (without changing the parser’s state) based on the current state and input character, if None is returned the state hasn’t changed

Source

pub fn parse(&mut self, elements: &mut HashSet<LayoutElement<'a>>)

parse the given text to generate layout elements and add it to the set passed in parameter.

Auto Trait Implementations§

§

impl<'a> Freeze for Parser<'a>

§

impl<'a> RefUnwindSafe for Parser<'a>

§

impl<'a> Send for Parser<'a>

§

impl<'a> Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> UnwindSafe for Parser<'a>

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.