pub struct WhitespaceResult { /* private fields */ }Expand description
Information about whitespace consumed by an input scanning hook.
Tabs and spaces are tracked independently. When SkipTabs::No leaves a tab in the input,
that tab is not included in this result. Characters inside a skipped comment do not affect
either flag.
§Examples
use granit_parser::{input::{SkipTabs, WhitespaceResult}, BufferedInput, Input};
let mut input = BufferedInput::new(" \t#comment".chars());
let (consumed, result) = input.skip_ws_to_eol_blanks(SkipTabs::Yes);
assert_eq!(consumed, 2);
assert_eq!(result, WhitespaceResult::new(true, true));
assert!(result.found_tabs());
assert!(result.has_valid_yaml_ws());Implementations§
Source§impl WhitespaceResult
impl WhitespaceResult
Sourcepub const fn new(found_tabs: bool, has_valid_yaml_ws: bool) -> Self
pub const fn new(found_tabs: bool, has_valid_yaml_ws: bool) -> Self
Create whitespace information from independently tracked tabs and spaces.
has_valid_yaml_ws indicates whether at least one space was consumed outside a comment.
Sourcepub const fn found_tabs(self) -> bool
pub const fn found_tabs(self) -> bool
Return whether at least one tab was consumed outside a comment.
Sourcepub const fn has_valid_yaml_ws(self) -> bool
pub const fn has_valid_yaml_ws(self) -> bool
Return whether at least one space was consumed outside a comment.
Trait Implementations§
Source§impl Clone for WhitespaceResult
impl Clone for WhitespaceResult
Source§fn clone(&self) -> WhitespaceResult
fn clone(&self) -> WhitespaceResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WhitespaceResult
Source§impl Debug for WhitespaceResult
impl Debug for WhitespaceResult
impl Eq for WhitespaceResult
Source§impl PartialEq for WhitespaceResult
impl PartialEq for WhitespaceResult
impl StructuralPartialEq for WhitespaceResult
Auto Trait Implementations§
impl Freeze for WhitespaceResult
impl RefUnwindSafe for WhitespaceResult
impl Send for WhitespaceResult
impl Sync for WhitespaceResult
impl Unpin for WhitespaceResult
impl UnsafeUnpin for WhitespaceResult
impl UnwindSafe for WhitespaceResult
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