pub struct NamePattern(pub Vec<PatternComponent>);Expand description
A name pattern with named capture groups.
Used by the trust schema to express rules like:
“Data under /sensor/<node>/<type> must be signed by /sensor/<node>/KEY/<id>”
where <node> must match in both patterns.
§Text format
Patterns can be parsed from and serialized to a human-readable string:
/literal→PatternComponent::Literal/<var>→PatternComponent::Capture— matches one name component/<**var>→PatternComponent::MultiCapture— matches all remaining components (must be last)
Example: /sensor/<node>/KEY/<id> parses to
[Literal("sensor"), Capture("node"), Literal("KEY"), Capture("id")].
Tuple Fields§
§0: Vec<PatternComponent>Implementations§
Source§impl NamePattern
impl NamePattern
Sourcepub fn parse(s: &str) -> Result<Self, PatternParseError>
pub fn parse(s: &str) -> Result<Self, PatternParseError>
Parse a pattern from a text string.
Components are /-separated. An empty leading / is ignored.
<var> is a single-component capture; <**var> is a multi-component
capture (must be the last component in the pattern).
§Examples
use ndn_security::trust_schema::NamePattern;
let p = NamePattern::parse("/sensor/<node>/KEY/<id>").unwrap();Trait Implementations§
Source§impl Clone for NamePattern
impl Clone for NamePattern
Source§fn clone(&self) -> NamePattern
fn clone(&self) -> NamePattern
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 moreSource§impl Debug for NamePattern
impl Debug for NamePattern
Source§impl Display for NamePattern
impl Display for NamePattern
Source§impl PartialEq for NamePattern
impl PartialEq for NamePattern
impl Eq for NamePattern
impl StructuralPartialEq for NamePattern
Auto Trait Implementations§
impl Freeze for NamePattern
impl RefUnwindSafe for NamePattern
impl Send for NamePattern
impl Sync for NamePattern
impl Unpin for NamePattern
impl UnwindSafe for NamePattern
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more