pub struct Rule { /* private fields */ }Expand description
A rule is an expression with a name
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn new(
name: impl Into<String>,
metadata: BTreeMap<String, Value>,
expr: Expr,
) -> Self
pub fn new( name: impl Into<String>, metadata: BTreeMap<String, Value>, expr: Expr, ) -> Self
Construct a new rule from a name and an expression
Sourcepub fn get_metadata(&self, field: &str) -> Option<&Value>
pub fn get_metadata(&self, field: &str) -> Option<&Value>
Read a metadata field by name
pub fn iter_metadata(&self) -> impl Iterator<Item = (&str, &Value)>
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
Return an optional description of the rule
pub fn expr(&self) -> &Expr
Trait Implementations§
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more