pub enum Binding {
BindScalar(Variable),
BindColl(Variable),
BindRel(Vec<VariableOrPlaceholder>),
BindTuple(Vec<VariableOrPlaceholder>),
}Variants§
BindScalar(Variable)
BindColl(Variable)
BindRel(Vec<VariableOrPlaceholder>)
BindTuple(Vec<VariableOrPlaceholder>)
Implementations§
Source§impl Binding
impl Binding
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true if no variables are bound, i.e., all binding entries are placeholders.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Return true if no variable is bound twice, i.e., each binding entry is either a
placeholder or unique.
ⓘ
use edn::query::{Binding,Variable,VariableOrPlaceholder};
use std::rc::Rc;
let v = "?foo".to_var();
let vv = VariableOrPlaceholder::Variable(v);
let p = VariableOrPlaceholder::Placeholder;
let e = Binding::BindTuple(vec![p.clone()]);
let b = Binding::BindTuple(vec![p.clone(), vv.clone()]);
let d = Binding::BindTuple(vec![vv.clone(), p, vv]);
assert!(b.is_valid()); // One var, one placeholder: OK.
assert!(!e.is_valid()); // Empty: not OK.
assert!(!d.is_valid()); // Duplicate var: not OK.Trait Implementations§
Source§impl ContainsVariables for Binding
impl ContainsVariables for Binding
fn accumulate_mentioned_variables(&self, acc: &mut BTreeSet<Variable>)
fn collect_mentioned_variables(&self) -> BTreeSet<Variable>
impl Eq for Binding
impl StructuralPartialEq for Binding
Auto Trait Implementations§
impl Freeze for Binding
impl RefUnwindSafe for Binding
impl Send for Binding
impl Sync for Binding
impl Unpin for Binding
impl UnsafeUnpin for Binding
impl UnwindSafe for Binding
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