pub struct PredGuard<O, L> {
pub expr: RPredExpr<O, L>,
pub truthy: fn(&L) -> bool,
}Expand description
A resolved primitive predicate guard: the computation, plus the truth test for the literal model the query was resolved against.
Both function pointers come from the model (LitOpDesc::eval, LitModel::is_truthy)
and are captured at resolve time, which is what keeps the matcher generic over the
value type alone rather than over the whole model.
Fields§
§expr: RPredExpr<O, L>§truthy: fn(&L) -> boolLitModel::is_truthy: the guard passes when the value it computes is true.
Trait Implementations§
impl<O: Eq, L: Eq> Eq for PredGuard<O, L>
Source§impl<O: PartialEq, L: PartialEq> PartialEq for PredGuard<O, L>
Equality on the computation, not on the captured function pointers: an operator
determines its own eval, and the truth test is a property of the model, which is
fixed for a program. Comparing the pointers would be comparing addresses that the
compiler is free to merge or duplicate.
impl<O: PartialEq, L: PartialEq> PartialEq for PredGuard<O, L>
Equality on the computation, not on the captured function pointers: an operator
determines its own eval, and the truth test is a property of the model, which is
fixed for a program. Comparing the pointers would be comparing addresses that the
compiler is free to merge or duplicate.
Auto Trait Implementations§
impl<O, L> Freeze for PredGuard<O, L>
impl<O, L> RefUnwindSafe for PredGuard<O, L>
impl<O, L> Send for PredGuard<O, L>
impl<O, L> Sync for PredGuard<O, L>
impl<O, L> Unpin for PredGuard<O, L>
impl<O, L> UnsafeUnpin for PredGuard<O, L>
impl<O, L> UnwindSafe for PredGuard<O, L>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.