pub struct ContentExpr { /* private fields */ }Expand description
A parsed, validated content expression. Matching runs an NFA simulation over the observed block sequence so a failure can report the exact position and the terminals that would have been legal there.
Implementations§
Source§impl ContentExpr
impl ContentExpr
Sourcepub fn parse(source: &str) -> Result<Self, ContentExprError>
pub fn parse(source: &str) -> Result<Self, ContentExprError>
Parse and validate an expression string. The compiled expression is cached on the schema at load time — parse once, match per write.
Sourcepub fn mentioned_names(&self) -> Vec<&str>
pub fn mentioned_names(&self) -> Vec<&str>
The distinct block names the expression mentions — the loader
uses this for item_pattern legality (“exactly one of list
/ paragraph”, counted by name, repeated occurrences of the
same kind are fine).
Sourcepub fn match_blocks(&self, blocks: &[ObservedBlock]) -> Result<(), MatchFailure>
pub fn match_blocks(&self, blocks: &[ObservedBlock]) -> Result<(), MatchFailure>
Match the observed block sequence against the expression.
Trait Implementations§
Source§impl Clone for ContentExpr
impl Clone for ContentExpr
Source§fn clone(&self) -> ContentExpr
fn clone(&self) -> ContentExpr
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContentExpr
impl Debug for ContentExpr
impl Eq for ContentExpr
Source§impl PartialEq for ContentExpr
impl PartialEq for ContentExpr
impl StructuralPartialEq for ContentExpr
Auto Trait Implementations§
impl Freeze for ContentExpr
impl RefUnwindSafe for ContentExpr
impl Send for ContentExpr
impl Sync for ContentExpr
impl Unpin for ContentExpr
impl UnsafeUnpin for ContentExpr
impl UnwindSafe for ContentExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.