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>
impl<'a> Parser<'a>
pub fn new(text: &'a str) -> Self
pub fn reset_indexes(&mut self)
pub fn tag_name(&self) -> Option<&'a str>
pub fn tag_name_new(&self) -> &'a str
pub fn attribute_name(&self) -> Option<&'a str>
pub fn layout_attribute_value(&self) -> Option<&'a str>
pub fn layout_breakpoint_attribute_value(&self) -> Option<&'a str>
Sourcepub fn update_biggest_breakpoint(&mut self, breakpoint: usize) -> bool
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
Sourcepub fn transition(&self, c: char) -> Option<State>
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
Sourcepub fn parse(&mut self, elements: &mut HashSet<LayoutElement<'a>>)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more