pub struct CompiledPredicate { /* private fields */ }Expand description
A predicate parsed once, testing tuples.
Implementations§
Source§impl CompiledPredicate
impl CompiledPredicate
Sourcepub fn keeps(
&self,
tuple: &RuntimeTuple,
scope: &dyn Lookup,
) -> Result<bool, RuntimeError>
pub fn keeps( &self, tuple: &RuntimeTuple, scope: &dyn Lookup, ) -> Result<bool, RuntimeError>
Whether tuple, drawn in scope, passes: the predicate’s value
is true. A predicate whose value is None keeps no tuple.
Source§impl CompiledPredicate
impl CompiledPredicate
Sourcepub fn is_total(&self, kind_of: &dyn Fn(&str) -> Option<ValueKind>) -> bool
pub fn is_total(&self, kind_of: &dyn Fn(&str) -> Option<ValueKind>) -> bool
Whether no evaluation of the predicate can fail over tuples whose
elements have the kinds kind_of gives, None for an element of
unknown or mixed kind (comprehension_forms.md §10.2 R5).
The answer is read off the predicate’s tree. ||, &&, and !
are total over operands that are total and have a truth value (a
boolean or a number, never a string). ==, !=, and membership
are total over total operands, since values of different kinds
are unequal; an ordering comparison is total only when both sides
are numbers, both strings, or both booleans. Arithmetic is total
over numeric operands, dividing only by a non-zero constant. An
element is total when its kind is known, a literal always is, and
any other expression (a function call, a cast, a bitwise
operator) can fail.
Trait Implementations§
Source§impl Clone for CompiledPredicate
impl Clone for CompiledPredicate
Auto Trait Implementations§
impl Freeze for CompiledPredicate
impl RefUnwindSafe for CompiledPredicate
impl Send for CompiledPredicate
impl Sync for CompiledPredicate
impl Unpin for CompiledPredicate
impl UnsafeUnpin for CompiledPredicate
impl UnwindSafe for CompiledPredicate
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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