pub struct Forest<'i, I, P, TK>{ /* private fields */ }
Expand description
Shared Packed Parse Forest (SPPF) returned by the GLR parser.
A forest is an ordered collection of trees. Basically, a wrapper around GSS structure to provide information about number of trees/solutions, ambiguities and to provide tree extraction/navigation.
Trees of the forest are ordered and each tree can be extracted as either an eager or a lazy tree given its index.
Implementations§
source§impl<'i, I, P, TK> Forest<'i, I, P, TK>
impl<'i, I, P, TK> Forest<'i, I, P, TK>
pub fn new(results: Vec<Rc<SPPFTree<'i, I, P, TK>>>) -> Self
pub fn get_first_tree(&self) -> Option<Tree<'i, I, P, TK>>
sourcepub fn get_tree(&self, idx: usize) -> Option<Tree<'i, I, P, TK>>
pub fn get_tree(&self, idx: usize) -> Option<Tree<'i, I, P, TK>>
Extracts a tree with the given index
pub fn is_empty(&self) -> bool
sourcepub fn ambiguities(&self) -> usize
pub fn ambiguities(&self) -> usize
Total number of ambiguous places/nodes in this forest.
Extracted trees are unambiguous but forests may have ambiguities. If there is >1 trees in the forest there are ambiguities.
Trait Implementations§
source§impl<'i, 'f, I, P, TK> IntoIterator for &'f Forest<'i, I, P, TK>
impl<'i, 'f, I, P, TK> IntoIterator for &'f Forest<'i, I, P, TK>
For loop iteration over borrowed Forest
source§impl<'i, I, P, TK> IntoIterator for Forest<'i, I, P, TK>
impl<'i, I, P, TK> IntoIterator for Forest<'i, I, P, TK>
Auto Trait Implementations§
impl<'i, I, P, TK> !RefUnwindSafe for Forest<'i, I, P, TK>
impl<'i, I, P, TK> !Send for Forest<'i, I, P, TK>
impl<'i, I, P, TK> !Sync for Forest<'i, I, P, TK>
impl<'i, I: ?Sized, P, TK> Unpin for Forest<'i, I, P, TK>
impl<'i, I, P, TK> !UnwindSafe for Forest<'i, I, P, TK>
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