pub enum Operand {
Expression(Expression),
Term(Term),
}Expand description
Operand.
Variants§
Trait Implementations§
Source§impl From<Expression> for Operand
impl From<Expression> for Operand
Source§fn from(expr: Expression) -> Self
fn from(expr: Expression) -> Self
Creates an operand from an expression.
Source§impl ToSpecificity for Operand
impl ToSpecificity for Operand
Source§fn to_specificity(&self) -> Specificity
fn to_specificity(&self) -> Specificity
Computes the specificity of the operand.
§Examples
use zrx_id::expression::Operand;
use zrx_id::selector;
use zrx_id::specificity::ToSpecificity;
// Create operand and compute specificity
let operand = Operand::from(selector!(location = "**/*.md")?);
assert_eq!(operand.to_specificity(), (0, 1, 1, 3).into());impl Eq for Operand
impl StructuralPartialEq for Operand
Auto Trait Implementations§
impl Freeze for Operand
impl RefUnwindSafe for Operand
impl Send for Operand
impl Sync for Operand
impl Unpin for Operand
impl UnsafeUnpin for Operand
impl UnwindSafe for Operand
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<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)?;