pub struct DomainLiteralMatcher { /* private fields */ }Expand description
A matcher accepting Expr::Number literals in exactly one domain.
§Examples
use sim_kernel::{Expr, NumberLiteral};
use sim_lib_numbers_core::{DomainLiteralMatcher, ScalarLiteralMatcher, domains};
let matcher = DomainLiteralMatcher::new(domains::i64());
let lit = Expr::Number(NumberLiteral {
domain: domains::i64(),
canonical: "42".to_owned(),
});
assert!(matcher.matches_expr(&lit));
assert!(!matcher.matches_expr(&Expr::String("42".to_owned())));Implementations§
Trait Implementations§
Source§impl ScalarLiteralMatcher for DomainLiteralMatcher
impl ScalarLiteralMatcher for DomainLiteralMatcher
Source§fn matches_expr(&self, expr: &Expr) -> bool
fn matches_expr(&self, expr: &Expr) -> bool
Whether
expr is a number literal this matcher accepts.Auto Trait Implementations§
impl Freeze for DomainLiteralMatcher
impl RefUnwindSafe for DomainLiteralMatcher
impl Send for DomainLiteralMatcher
impl Sync for DomainLiteralMatcher
impl Unpin for DomainLiteralMatcher
impl UnsafeUnpin for DomainLiteralMatcher
impl UnwindSafe for DomainLiteralMatcher
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