pub struct PredicateBinder { /* private fields */ }Expand description
A compiled predicate template: the form of a filter, prepared once.
Compiled against two things — a PredicateTemplate, which
supplies the fields and operators, and the metadata layout, which
supplies the types. Neither alone is enough: a predicate knows what
it constrains and not what type that field is.
The conditions are in canonical order (see
shape), and
bind_each hands a predicate’s comparands over
in that order, however the predicate wrote its conditions. So one
binder serves every predicate of a form — which is what a
FormCensus groups them by.
Implementations§
Source§impl PredicateBinder
impl PredicateBinder
Sourcepub fn compile(
template: &PredicateTemplate,
layout: &Layout,
) -> Result<PredicateBinder, BindError>
pub fn compile( template: &PredicateTemplate, layout: &Layout, ) -> Result<PredicateBinder, BindError>
Compile a predicate template.
Only a flat conjunction compiles: a nested or disjunctive predicate has no flat parameter list, and pretending otherwise would bind values into the wrong conditions. Such a template is refused by name rather than partially flattened. A pinned slot is a parameter like an open one: the template supplies the structure, and every predicate bound supplies its own values.
Sourcepub fn with_overrides(
self,
overrides: &HashMap<String, String>,
) -> PredicateBinder
pub fn with_overrides( self, overrides: &HashMap<String, String>, ) -> PredicateBinder
Rename parameters for substitution, as the metadata binder does.
Sourcepub fn conditions(&self) -> &[Condition]
pub fn conditions(&self) -> &[Condition]
The conditions, in canonical order. Read once, to build the filter.
Sourcepub fn template(&self) -> PredicateTemplate
pub fn template(&self) -> PredicateTemplate
The template this binder binds: its conditions in canonical order, every comparand an open slot. What the filter’s text is rendered from.
Sourcepub fn bind_each<F>(&self, record: &[u8], f: F) -> Result<(), BindError>
pub fn bind_each<F>(&self, record: &[u8], f: F) -> Result<(), BindError>
Bind one predicate record, handing each condition’s comparands
to f in condition order.
The record is checked against the compiled shape first: a predicate of a different shape would otherwise bind values into conditions they do not belong to, which no downstream check would catch.
Trait Implementations§
Source§impl Clone for PredicateBinder
impl Clone for PredicateBinder
Source§fn clone(&self) -> PredicateBinder
fn clone(&self) -> PredicateBinder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Forget for PredicateBinder
impl Freeze for PredicateBinderwhere
*const u8 is !null: Freeze,
PhantomData<Condition>: Freeze,
PhantomData<ShapeCondition>: Freeze,
impl Move for PredicateBinder
impl RefUnwindSafe for PredicateBinder
impl Send for PredicateBinder
impl Sync for PredicateBinder
impl Unpin for PredicateBinder
impl UnsafeUnpin for PredicateBinderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Condition>: UnsafeUnpin,
PhantomData<ShapeCondition>: UnsafeUnpin,
impl UnwindSafe for PredicateBinder
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