pub struct WhereBlockTracker {
pub indent_stack: IndentStack,
pub in_where_block: bool,
pub where_items: Vec<(String, usize)>,
}Expand description
Tracks where blocks and their item indentation.
Fields§
§indent_stack: IndentStack§in_where_block: bool§where_items: Vec<(String, usize)>Each entry is (item_name, indent_width).
Implementations§
Source§impl WhereBlockTracker
impl WhereBlockTracker
pub fn new() -> Self
Sourcepub fn enter_where(&mut self, base_indent: IndentLevel)
pub fn enter_where(&mut self, base_indent: IndentLevel)
Enter a where block at the given base indentation.
Sourcepub fn exit_where(&mut self)
pub fn exit_where(&mut self)
Exit the current where block.
Sourcepub fn add_where_item(&mut self, name: &str, indent: IndentLevel)
pub fn add_where_item(&mut self, name: &str, indent: IndentLevel)
Register a named item inside the where block at the given indent.
Sourcepub fn is_where_item(&self, _line: &str, indent: IndentLevel) -> bool
pub fn is_where_item(&self, _line: &str, indent: IndentLevel) -> bool
Check whether line at indent is a valid where-block item.
Sourcepub fn parse_leading_whitespace(line: &str) -> IndentLevel
pub fn parse_leading_whitespace(line: &str) -> IndentLevel
Parse the leading whitespace of a line into an IndentLevel.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WhereBlockTracker
impl RefUnwindSafe for WhereBlockTracker
impl Send for WhereBlockTracker
impl Sync for WhereBlockTracker
impl Unpin for WhereBlockTracker
impl UnsafeUnpin for WhereBlockTracker
impl UnwindSafe for WhereBlockTracker
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