pub enum Atom<'a> {
Literal(&'a str),
Wildcard(Wildcard),
Character(Character<'a>),
Group(Vec<Segments<'a>>),
}Expand description
Atom.
Atoms are the basic building blocks of Segments, representing literals,
wildcards, character classes and groups of alternatives. Each Segment
contains a set of atoms that define which Specificity the segment has,
where specificity is determined by the least specific atom in the segment.
Variants§
Literal(&'a str)
Literal, e.g., main.rs
Wildcard(Wildcard)
Wildcard, i.e., ?, *, or **.
Character(Character<'a>)
Character class, e.g., [xyz].
Group(Vec<Segments<'a>>)
Alternate group, e.g., {*.rs,*.md}.
Trait Implementations§
impl<'a> Eq for Atom<'a>
Source§impl<'a> FromIterator<Atom<'a>> for Segment<'a>
impl<'a> FromIterator<Atom<'a>> for Segment<'a>
impl<'a> StructuralPartialEq for Atom<'a>
Source§impl ToSpecificity for Atom<'_>
impl ToSpecificity for Atom<'_>
Source§fn to_specificity(&self) -> Specificity
fn to_specificity(&self) -> Specificity
Computes the specificity of the atom.
Auto Trait Implementations§
impl<'a> Freeze for Atom<'a>
impl<'a> RefUnwindSafe for Atom<'a>
impl<'a> Send for Atom<'a>
impl<'a> Sync for Atom<'a>
impl<'a> Unpin for Atom<'a>
impl<'a> UnsafeUnpin for Atom<'a>
impl<'a> UnwindSafe for Atom<'a>
Blanket Implementations§
impl<T> Arguments for T
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<T> Pointable for T
impl<T> Pointable for T
Source§impl<K, V> TryAsStorage<K> for V
impl<K, V> TryAsStorage<K> for V
Source§fn try_as_storage(
item: &(dyn Any + 'static),
) -> Result<<V as TryAsStorage<K>>::Target<'_>, Error>
fn try_as_storage( item: &(dyn Any + 'static), ) -> Result<<V as TryAsStorage<K>>::Target<'_>, Error>
Attempts to convert into a storage reference.
§Errors
The following errors might be returned:
Error::Downcast: Item cannot be downcast.
§Examples
use std::any::Any;
use zrx_storage::convert::TryAsStorage;
use zrx_storage::Storage;
// Create storage and initial state
let mut storage = Storage::default();
storage.insert("key", 42);
// Obtain type-erased reference
let item: &dyn Any = &storage;
// Obtain storage reference
let storage = <i32>::try_as_storage(item)?;Source§impl<K, V> TryAsStorageMut<K> for V
impl<K, V> TryAsStorageMut<K> for V
Source§fn try_as_storage_mut(
item: &mut (dyn Any + 'static),
) -> Result<<V as TryAsStorageMut<K>>::Target<'_>, Error>
fn try_as_storage_mut( item: &mut (dyn Any + 'static), ) -> Result<<V as TryAsStorageMut<K>>::Target<'_>, Error>
Attempts to convert into a mutable storage reference.
§Errors
The following errors might be returned:
Error::Downcast: Item cannot be downcast.
§Examples
use std::any::Any;
use zrx_storage::convert::TryAsStorageMut;
use zrx_storage::Storage;
// Create storage and initial state
let mut storage = Storage::default();
storage.insert("key", 42);
// Obtain mutable type-erased reference
let item: &mut dyn Any = &mut storage;
// Obtain mutable storage reference
let storage = <i32>::try_as_storage_mut(item)?;