pub struct ScopeManager { /* private fields */ }Expand description
Tracks syntactic nesting and block context during parsing.
Implementations§
Source§impl ScopeManager
impl ScopeManager
Sourcepub const fn nesting_depth(&self) -> i32
pub const fn nesting_depth(&self) -> i32
Returns the current nesting depth
Sourcepub const fn current_block(&self) -> BlockType
pub const fn current_block(&self) -> BlockType
Returns the current block type
Sourcepub const fn in_nested_context(&self) -> bool
pub const fn in_nested_context(&self) -> bool
Returns true if we’re currently inside any nested structure
Sourcepub fn enter_block(&mut self, block_type: BlockType)
pub fn enter_block(&mut self, block_type: BlockType)
Enters a new block (opening brace or bracket)
Sourcepub fn exit_block(&mut self) -> Result<(), ScopeError>
pub fn exit_block(&mut self) -> Result<(), ScopeError>
Exits a block (closing brace or bracket)
Returns Ok(()) if the block nesting is balanced, or Err(()) if
we’re trying to exit without having entered.
§Errors
Returns Err(ScopeError::UnbalancedExit) when an exit is attempted
while the nesting depth is already zero.
Sourcepub fn accumulated_content(&self) -> &str
pub fn accumulated_content(&self) -> &str
Returns the accumulated content for multi-line directives
Sourcepub fn accumulate(&mut self, text: &str)
pub fn accumulate(&mut self, text: &str)
Appends text to the accumulated content
Sourcepub fn clear_accumulated(&mut self)
pub fn clear_accumulated(&mut self)
Clears the accumulated content
Sourcepub const fn block_is_complete(&self) -> bool
pub const fn block_is_complete(&self) -> bool
Returns true if a multi-line block has been completed (balanced braces)
Trait Implementations§
Source§impl Debug for ScopeManager
impl Debug for ScopeManager
Auto Trait Implementations§
impl Freeze for ScopeManager
impl RefUnwindSafe for ScopeManager
impl Send for ScopeManager
impl Sync for ScopeManager
impl Unpin for ScopeManager
impl UnsafeUnpin for ScopeManager
impl UnwindSafe for ScopeManager
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.