pub struct PathPat(pub Vec<SegPat>);Expand description
A path pattern. Unlike a concrete Seg path it can reach every element of
a sequence (SegPat::EachItem), every entry of a mapping
(SegPat::AnyKey), or a whole subtree (SegPat::AnyDepth), so a rule
can constrain each item of a list field (tags:, audience:) or
everything beneath a key.
Tuple Fields§
§0: Vec<SegPat>Implementations§
Source§impl PathPat
impl PathPat
Sourcepub fn key(name: impl Into<String>) -> Self
pub fn key(name: impl Into<String>) -> Self
A single top-level key — the common case (audience, title).
Sourcepub fn each_item_of(name: impl Into<String>) -> Self
pub fn each_item_of(name: impl Into<String>) -> Self
A top-level list field whose each item the rule governs
(audience: as a sequence).
Sourcepub fn subtree_of(name: impl Into<String>) -> Self
pub fn subtree_of(name: impl Into<String>) -> Self
A top-level key and everything nested beneath it, the key itself
included (meta, meta.author, meta.tags.0).
Sourcepub fn matches(&self, path: &[Seg]) -> bool
pub fn matches(&self, path: &[Seg]) -> bool
Whether this pattern matches the concrete fig path. Without an
SegPat::AnyDepth this is a segment-wise match of equal lengths; with
one, the pattern may span any number of segments there.
Trait Implementations§
impl Eq for PathPat
impl StructuralPartialEq for PathPat
Auto Trait Implementations§
impl Freeze for PathPat
impl RefUnwindSafe for PathPat
impl Send for PathPat
impl Sync for PathPat
impl Unpin for PathPat
impl UnsafeUnpin for PathPat
impl UnwindSafe for PathPat
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