pub struct DirectiveWithContext<'a> {
pub directive: &'a Directive,
pub parent_stack: Vec<String>,
pub depth: usize,
}Expand description
A directive paired with its parent block context.
Yielded by Config::all_directives_with_context().
Provides methods to query the parent block hierarchy without manually tracking nesting.
Fields§
§directive: &'a DirectiveThe directive itself.
parent_stack: Vec<String>Stack of parent directive names (e.g., ["http", "server"]).
depth: usizeNesting depth (0 = root level).
Implementations§
Source§impl<'a> DirectiveWithContext<'a>
impl<'a> DirectiveWithContext<'a>
Sourcepub fn is_inside(&self, parent_name: &str) -> bool
pub fn is_inside(&self, parent_name: &str) -> bool
Check if this directive is inside a specific parent context
Sourcepub fn parent_is(&self, parent_name: &str) -> bool
pub fn parent_is(&self, parent_name: &str) -> bool
Check if the immediate parent is a specific directive
Sourcepub fn is_at_root(&self) -> bool
pub fn is_at_root(&self) -> bool
Check if this directive is at root level
Trait Implementations§
Source§impl<'a> Clone for DirectiveWithContext<'a>
impl<'a> Clone for DirectiveWithContext<'a>
Source§fn clone(&self) -> DirectiveWithContext<'a>
fn clone(&self) -> DirectiveWithContext<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for DirectiveWithContext<'a>
impl<'a> RefUnwindSafe for DirectiveWithContext<'a>
impl<'a> Send for DirectiveWithContext<'a>
impl<'a> Sync for DirectiveWithContext<'a>
impl<'a> Unpin for DirectiveWithContext<'a>
impl<'a> UnwindSafe for DirectiveWithContext<'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