pub struct CommandPattern {
pub tokens: Vec<String>,
pub has_glob_suffix: bool,
}Expand description
A parsed allowlist pattern. Matches against an argv slice of any
AsRef<str> type (e.g. &[String], &[&str], &[Cow<'_, str>]).
Fields§
§tokens: Vec<String>§has_glob_suffix: boolImplementations§
Source§impl CommandPattern
impl CommandPattern
Sourcepub fn parse(s: &str) -> Result<Self, String>
pub fn parse(s: &str) -> Result<Self, String>
Parse a single pattern string. Tokens are whitespace-separated.
A trailing :* (no whitespace before it) marks the pattern as
a prefix match; otherwise the pattern is exact-length.
Errors:
- empty / whitespace-only input
- a lone
:*with no preceding tokens
Trait Implementations§
Source§impl Clone for CommandPattern
impl Clone for CommandPattern
Source§fn clone(&self) -> CommandPattern
fn clone(&self) -> CommandPattern
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 CommandPattern
impl Debug for CommandPattern
Source§impl PartialEq for CommandPattern
impl PartialEq for CommandPattern
Source§fn eq(&self, other: &CommandPattern) -> bool
fn eq(&self, other: &CommandPattern) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for CommandPattern
impl StructuralPartialEq for CommandPattern
Auto Trait Implementations§
impl Freeze for CommandPattern
impl RefUnwindSafe for CommandPattern
impl Send for CommandPattern
impl Sync for CommandPattern
impl Unpin for CommandPattern
impl UnsafeUnpin for CommandPattern
impl UnwindSafe for CommandPattern
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