pub struct SubUnitExtractor { /* private fields */ }Expand description
Walks a normalized tree and collects the compound structures inside it.
Every node kind that carries a body contributes that body as a candidate
sub-unit, and the walk then descends into all children regardless. What
varies between kinds is only which child holds the body, so most of them
reduce to a lookup; If and Match are the two that do not, because one
has an optional second branch and the other has a variable number.
Implementations§
Source§impl SubUnitExtractor
impl SubUnitExtractor
pub const fn new(min_node_count: usize) -> Self
Sourcepub fn extract(&self, node: &NormalizedNode) -> Vec<SubUnit>
pub fn extract(&self, node: &NormalizedNode) -> Vec<SubUnit>
Collect every sub-unit at or below node that meets the node floor.
A node’s own contributions come before its children’s, and children are visited in order, so the result is a pre-order walk.
Auto Trait Implementations§
impl Freeze for SubUnitExtractor
impl RefUnwindSafe for SubUnitExtractor
impl Send for SubUnitExtractor
impl Sync for SubUnitExtractor
impl Unpin for SubUnitExtractor
impl UnsafeUnpin for SubUnitExtractor
impl UnwindSafe for SubUnitExtractor
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