Enum entity::Predicate[][src]

pub enum Predicate {
Show variants Always, Never, And(Vec<Predicate>), Any(Box<Predicate>), Contains(Value), ContainsAll(Vec<Value>), ContainsAny(Vec<Value>), Equals(Value), GreaterThan(Value), GreaterThanOrEquals(Value), HasKey(String), HasKeyWhereValue(StringBox<Predicate>), InRange(RangeInclusive<Value>), InSet(HashSet<Value>), IsNone, Lambda(Rc<dyn Fn(&Value) -> bool>), LessThan(Value), LessThanOrEquals(Value), Not(Box<Predicate>), NotEquals(Value), NotInRange(RangeInclusive<Value>), NotInSet(HashSet<Value>), NotNoneAnd(Box<Predicate>), NoneOr(Box<Predicate>), Or(Vec<Predicate>), TextContainedIn(String), TextContainedInCaseInsensitive(String), TextContainsAll(Vec<String>), TextContainsAllCaseInsensitive(Vec<String>), TextContainsAny(Vec<String>), TextContainsAnyCaseInsensitive(Vec<String>), TextEndsWith(String), TextEndsWithCaseInsensitive(String), TextEndsWithAny(Vec<String>), TextEndsWithAnyCaseInsensitive(Vec<String>), TextEqualsCaseInsensitive(String), TextNotEqualsCaseInsensitive(String), TextInSetCaseInsensitive(HashSet<String>), TextStartsWith(String), TextStartsWithCaseInsensitive(String), TextStartsWithAny(Vec<String>), TextStartsWithAnyCaseInsensitive(Vec<String>), Xor(Vec<Predicate>),
}

Represents an untyped predicate that can be used to inspect a value for some specified condition

Variants

Always

Will always be true (not same as equals(true))

Examples

use entity::{Predicate, ValueLike};
let v = 123.into_value();

let p = Predicate::Always;
assert_eq!(p.check(&v), true);
Never

Will always be false (not same as equals(false))

use entity::{Predicate, ValueLike};
let v = 123.into_value();

let p = Predicate::Never;
assert_eq!(p.check(&v), false);

Will be true if all predicates return true against the checked value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::And(vec![
    Predicate::GreaterThan(122.into_value()),
    Predicate::LessThan(124.into_value()),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::And(vec![
    Predicate::GreaterThan(122.into_value()),
    Predicate::Never,
]);
assert_eq!(p.check(&v), false);

let p = Predicate::And(vec![
    Predicate::Never,
    Predicate::GreaterThan(122.into_value()),
]);
assert_eq!(p.check(&v), false);

let p = Predicate::And(vec![
    Predicate::Never,
    Predicate::Never,
]);
assert_eq!(p.check(&v), false);

Will be true if checked value is a collection where any element satisifies the predicate

Examples

use entity::{Predicate, Value, ValueLike};
let v = vec![1, 2, 3].into_value();

let p = Predicate::Any(Box::new(Predicate::Equals(2.into_value())));
assert_eq!(p.check(&v), true);

let p = Predicate::Any(Box::new(Predicate::Equals(999.into_value())));
assert_eq!(p.check(&v), false);

Also supports checking values of a map:

use entity::{Predicate, Value, ValueLike};
use std::collections::HashMap;
let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();
let v = map.into_value();

let p = Predicate::Any(Box::new(Predicate::Equals(2.into_value())));
assert_eq!(p.check(&v), true);

let p = Predicate::Any(Box::new(Predicate::Equals(999.into_value())));
assert_eq!(p.check(&v), false);
Contains(Value)

Will be true if checked value is a collection that contains the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = vec![1, 2, 3].into_value();

let p = Predicate::Contains(2.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::Contains(999.into_value());
assert_eq!(p.check(&v), false);

Also supports checking values of a map:

use entity::{Predicate, Value, ValueLike};
use std::collections::HashMap;
let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();
let v = map.into_value();

let p = Predicate::Contains(2.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::Contains(999.into_value());
assert_eq!(p.check(&v), false);
ContainsAll(Vec<Value>)

Will be true if checked value is a collection that contains all of the specified values

Examples

use entity::{Predicate, Value, ValueLike};
let v = vec![1, 2, 3].into_value();

let p = Predicate::ContainsAll(vec![2.into_value(), 3.into_value()]);
assert_eq!(p.check(&v), true);

let p = Predicate::ContainsAll(vec![2.into_value(), 999.into_value()]);
assert_eq!(p.check(&v), false);

Also supports checking values of a map:

use entity::{Predicate, Value, ValueLike};
use std::collections::HashMap;
let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();
let v = map.into_value();

let p = Predicate::ContainsAll(vec![2.into_value(), 3.into_value()]);
assert_eq!(p.check(&v), true);

let p = Predicate::ContainsAll(vec![2.into_value(), 999.into_value()]);
assert_eq!(p.check(&v), false);
ContainsAny(Vec<Value>)

Will be true if checked value is a collection that contains any of the specified values

Examples

use entity::{Predicate, Value, ValueLike};
let v = vec![1, 2, 3].into_value();

let p = Predicate::ContainsAny(vec![2.into_value(), 999.into_value()]);
assert_eq!(p.check(&v), true);

let p = Predicate::ContainsAny(vec![998.into_value(), 999.into_value()]);
assert_eq!(p.check(&v), false);

Also supports checking values of a map:

use entity::{Predicate, Value, ValueLike};
use std::collections::HashMap;
let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();
let v = map.into_value();

let p = Predicate::ContainsAny(vec![2.into_value(), 999.into_value()]);
assert_eq!(p.check(&v), true);

let p = Predicate::ContainsAny(vec![998.into_value(), 999.into_value()]);
assert_eq!(p.check(&v), false);
Equals(Value)

Will be true if checked value equals the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::Equals(123.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::Equals(456.into_value());
assert_eq!(p.check(&v), false);
GreaterThan(Value)

Will be true if checked value is greater than the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::GreaterThan(100.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::GreaterThan(123.into_value());
assert_eq!(p.check(&v), false);

let p = Predicate::GreaterThan(456.into_value());
assert_eq!(p.check(&v), false);
GreaterThanOrEquals(Value)

Will be true if checked value is greater than or equals the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::GreaterThanOrEquals(100.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::GreaterThanOrEquals(123.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::GreaterThanOrEquals(456.into_value());
assert_eq!(p.check(&v), false);
HasKey(String)

Will be true if checked value is a map that contains the specified key

Examples

use entity::{Predicate, Value, ValueLike};
use std::collections::HashMap;
let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();
let v = map.into_value();

let p = Predicate::HasKey(String::from("a"));
assert_eq!(p.check(&v), true);

let p = Predicate::HasKey(String::from("d"));
assert_eq!(p.check(&v), false);
HasKeyWhereValue(StringBox<Predicate>)

Will be true if checked value is a map that contains the specified key and corresponding value meets the specified predicate

Examples

use entity::{Predicate, Value, ValueLike};
use std::collections::HashMap;
let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();
let v = map.into_value();

let p = Predicate::HasKeyWhereValue(
    String::from("a"),
    Box::new(Predicate::Equals(1.into_value())),
);
assert_eq!(p.check(&v), true);

let p = Predicate::HasKeyWhereValue(
    String::from("b"),
    Box::new(Predicate::Equals(1.into_value())),
);
assert_eq!(p.check(&v), false);

let p = Predicate::HasKeyWhereValue(
    String::from("d"),
    Box::new(Predicate::Equals(1.into_value())),
);
assert_eq!(p.check(&v), false);

Will be true if checked value is within the specified range

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::InRange(100.into_value()..=200.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::InRange(200.into_value()..=300.into_value());
assert_eq!(p.check(&v), false);
InSet(HashSet<Value>)

Will be true if checked value is within the specified set

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::InSet(vec![
    122.into_value(),
    123.into_value(),
    124.into_value(),
].into_iter().collect());
assert_eq!(p.check(&v), true);

let p = Predicate::InSet(vec![
    222.into_value(),
    223.into_value(),
    224.into_value(),
].into_iter().collect());
assert_eq!(p.check(&v), false);
IsNone

Will be true if checked value optional and is none

Examples

use entity::{Predicate, Value, ValueLike};

let v = None::<u8>.into_value();
let p = Predicate::IsNone;
assert_eq!(p.check(&v), true);

let v = Some(123).into_value();
let p = Predicate::IsNone;
assert_eq!(p.check(&v), false);
Lambda(Rc<dyn Fn(&Value) -> bool>)

Will be true if checked value passes the lambda function by having it return true

Examples

use entity::{Predicate, Value, ValueLike};
use std::rc::Rc;
let v = 123.into_value();

let p = Predicate::Lambda(Rc::new(|v| v == &123.into_value()));
assert_eq!(p.check(&v), true);

let p = Predicate::Lambda(Rc::new(|v| v == &456.into_value()));
assert_eq!(p.check(&v), false);
LessThan(Value)

Will be true if checked value is less than the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::LessThan(200.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::LessThan(123.into_value());
assert_eq!(p.check(&v), false);

let p = Predicate::LessThan(100.into_value());
assert_eq!(p.check(&v), false);
LessThanOrEquals(Value)

Will be true if checked value is less than or equals the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::LessThanOrEquals(200.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::LessThanOrEquals(123.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::LessThanOrEquals(100.into_value());
assert_eq!(p.check(&v), false);

Will be true if checked value is does not pass the specified predicate

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::Not(Box::new(Predicate::Equals(200.into_value())));
assert_eq!(p.check(&v), true);

let p = Predicate::Not(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), false);
NotEquals(Value)

Will be true if checked value does not equal the specified value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::NotEquals(456.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::NotEquals(123.into_value());
assert_eq!(p.check(&v), false);
NotInRange(RangeInclusive<Value>)

Will be true if checked value is not within the specified range

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::NotInRange(200.into_value()..=300.into_value());
assert_eq!(p.check(&v), true);

let p = Predicate::NotInRange(100.into_value()..=200.into_value());
assert_eq!(p.check(&v), false);
NotInSet(HashSet<Value>)

Will be true if checked value is not within the specified set

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::NotInSet(vec![
    222.into_value(),
    223.into_value(),
    224.into_value(),
].into_iter().collect());
assert_eq!(p.check(&v), true);

let p = Predicate::NotInSet(vec![
    122.into_value(),
    123.into_value(),
    124.into_value(),
].into_iter().collect());
assert_eq!(p.check(&v), false);
NotNoneAnd(Box<Predicate>)

Will be true if checked value is not none and passes the specified predicate

Examples

use entity::{Predicate, Value, ValueLike};

let v = Some(123).into_value();
let p = Predicate::NotNoneAnd(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), true);

let v = 123.into_value();
let p = Predicate::NotNoneAnd(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), true);

let v = Some(456).into_value();
let p = Predicate::NotNoneAnd(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), false);

let v = 456.into_value();
let p = Predicate::NotNoneAnd(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), false);

let v = None::<u8>.into_value();
let p = Predicate::NotNoneAnd(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), false);
NoneOr(Box<Predicate>)

Will be true if checked value is either none or passes the specified predicate

Examples

use entity::{Predicate, Value, ValueLike};

let v = None::<u8>.into_value();
let p = Predicate::NoneOr(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), true);

let v = Some(123).into_value();
let p = Predicate::NoneOr(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), true);

let v = 123.into_value();
let p = Predicate::NoneOr(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), true);

let v = Some(456).into_value();
let p = Predicate::NoneOr(Box::new(Predicate::Equals(123.into_value())));
assert_eq!(p.check(&v), false);

Will be true if any predicate returns true against the checked value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::Or(vec![
    Predicate::GreaterThan(122.into_value()),
    Predicate::LessThan(124.into_value()),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::Or(vec![
    Predicate::Equals(123.into_value()),
    Predicate::Never,
]);
assert_eq!(p.check(&v), true);

let p = Predicate::Or(vec![
    Predicate::Never,
    Predicate::Equals(123.into_value()),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::Or(vec![
    Predicate::Never,
    Predicate::Never,
]);
assert_eq!(p.check(&v), false);
TextContainedIn(String)

Will be true if checked value is text that is a substring if the specified string (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("substring");

let p = Predicate::TextContainedIn(String::from("my substring of text"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextContainedIn(String::from("my string of text"));
assert_eq!(p.check(&v), false);
TextContainedInCaseInsensitive(String)

Will be true if checked value is text that is a substring if the specified string (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("substring");

let p = Predicate::TextContainedInCaseInsensitive(String::from("MY SUBSTRING OF TEXT"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextContainedInCaseInsensitive(String::from("my string of text"));
assert_eq!(p.check(&v), false);
TextContainsAll(Vec<String>)

Will be true if checked value is text that contains all of the specified strings as substrings (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextContainsAll(vec![
    String::from("my"),
    String::from("text"),
    String::from("compared"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextContainsAll(vec![
    String::from("my"),
    String::from("other"),
    String::from("compared"),
]);
assert_eq!(p.check(&v), false);
TextContainsAllCaseInsensitive(Vec<String>)

Will be true if checked value is text that contains all of the specified strings as substrings (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextContainsAllCaseInsensitive(vec![
    String::from("MY"),
    String::from("TEXT"),
    String::from("COMPARED"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextContainsAllCaseInsensitive(vec![
    String::from("my"),
    String::from("other"),
    String::from("compared"),
]);
assert_eq!(p.check(&v), false);
TextContainsAny(Vec<String>)

Will be true if checked value is text that contains any of the specified strings as substrings (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextContainsAny(vec![
    String::from("something"),
    String::from("text"),
    String::from("other"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextContainsAny(vec![
    String::from("something"),
    String::from("not"),
    String::from("other"),
]);
assert_eq!(p.check(&v), false);
TextContainsAnyCaseInsensitive(Vec<String>)

Will be true if checked value is text that contains any of the specified strings as substrings (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextContainsAnyCaseInsensitive(vec![
    String::from("SOMETHING"),
    String::from("TEXT"),
    String::from("OTHER"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextContainsAnyCaseInsensitive(vec![
    String::from("something"),
    String::from("not"),
    String::from("other"),
]);
assert_eq!(p.check(&v), false);
TextEndsWith(String)

Will be true if checked value is text that ends with the specified string (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextEndsWith(String::from("text"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextEndsWith(String::from("TEXT"));
assert_eq!(p.check(&v), false);
TextEndsWithCaseInsensitive(String)

Will be true if checked value is text that ends with the specified string (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextEndsWithCaseInsensitive(String::from("TEXT"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextEndsWithCaseInsensitive(String::from("some"));
assert_eq!(p.check(&v), false);
TextEndsWithAny(Vec<String>)

Will be true if checked value is text that ends with any of the specified strings (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextEndsWithAny(vec![
    String::from("something"),
    String::from("compared"),
    String::from("other"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextEndsWithAny(vec![
    String::from("something"),
    String::from("COMPARED"),
    String::from("other"),
]);
assert_eq!(p.check(&v), false);
TextEndsWithAnyCaseInsensitive(Vec<String>)

Will be true if checked value is text that ends with any of the specified strings (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextEndsWithAnyCaseInsensitive(vec![
    String::from("SOMETHING"),
    String::from("COMPARED"),
    String::from("OTHER"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextEndsWithAnyCaseInsensitive(vec![
    String::from("something"),
    String::from("text"),
    String::from("other"),
]);
assert_eq!(p.check(&v), false);
TextEqualsCaseInsensitive(String)

Will be true if checked value is text that equals the specified string (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextEqualsCaseInsensitive(String::from("SOME TEXT"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextEqualsCaseInsensitive(String::from("other text"));
assert_eq!(p.check(&v), false);
TextNotEqualsCaseInsensitive(String)

Will be true if checked value is text that does not equal the specified string (case insensitive); or if any other type than text

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextNotEqualsCaseInsensitive(String::from("other text"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextNotEqualsCaseInsensitive(String::from("SOME TEXT"));
assert_eq!(p.check(&v), false);
TextInSetCaseInsensitive(HashSet<String>)

Will be true if checked value is text that is found within the specified set of strings

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextInSetCaseInsensitive(vec![
    String::from("SOME"),
    String::from("SOME TEXT"),
    String::from("TEXT"),
].into_iter().collect());
assert_eq!(p.check(&v), true);

let p = Predicate::TextInSetCaseInsensitive(vec![
    String::from("OTHER"),
    String::from("OTHER TEXT"),
    String::from("TEXT"),
].into_iter().collect());
assert_eq!(p.check(&v), false);
TextStartsWith(String)

Will be true if checked value is text that starts with the specified string (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextStartsWith(String::from("some"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextStartsWith(String::from("SOME"));
assert_eq!(p.check(&v), false);
TextStartsWithCaseInsensitive(String)

Will be true if checked value is text that starts with the specified string (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("some text");

let p = Predicate::TextStartsWithCaseInsensitive(String::from("SOME"));
assert_eq!(p.check(&v), true);

let p = Predicate::TextStartsWithCaseInsensitive(String::from("text"));
assert_eq!(p.check(&v), false);
TextStartsWithAny(Vec<String>)

Will be true if checked value is text that starts with any of the specified strings as substrings (case sensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextStartsWithAny(vec![
    String::from("something"),
    String::from("my"),
    String::from("other"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextStartsWithAny(vec![
    String::from("something"),
    String::from("MY"),
    String::from("other"),
]);
assert_eq!(p.check(&v), false);
TextStartsWithAnyCaseInsensitive(Vec<String>)

Will be true if checked value is text that starts with any of the specified strings as substrings (case insensitive)

Examples

use entity::{Predicate, Value};
let v = Value::from("my text that is compared");

let p = Predicate::TextStartsWithAnyCaseInsensitive(vec![
    String::from("SOMETHING"),
    String::from("MY"),
    String::from("OTHER"),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::TextStartsWithAnyCaseInsensitive(vec![
    String::from("something"),
    String::from("not"),
    String::from("other"),
]);
assert_eq!(p.check(&v), false);

Will be true if only one predicate returns true against the checked value

Examples

use entity::{Predicate, Value, ValueLike};
let v = 123.into_value();

let p = Predicate::Xor(vec![
    Predicate::Never,
    Predicate::Equals(123.into_value()),
]);
assert_eq!(p.check(&v), true);

let p = Predicate::Xor(vec![
    Predicate::Equals(123.into_value()),
    Predicate::Never,
]);
assert_eq!(p.check(&v), true);

let p = Predicate::Xor(vec![
    Predicate::GreaterThan(122.into_value()),
    Predicate::LessThan(124.into_value()),
]);
assert_eq!(p.check(&v), false);

let p = Predicate::Xor(vec![
    Predicate::Never,
    Predicate::Never,
]);
assert_eq!(p.check(&v), false);

Implementations

impl Predicate[src]

pub fn check(&self, value: &Value) -> bool[src]

Checks if the predicate is satisfied by the given value

pub fn always() -> Self[src]

Creates a new predicate for Predicate::Always

Examples

use entity::{Predicate as P, Value as V};

let p = P::always();
assert_eq!(p.check(&V::from(1)), true);

pub fn never() -> Self[src]

Creates a new predicate for Predicate::Never

Examples

use entity::{Predicate as P, Value as V};

let p = P::never();
assert_eq!(p.check(&V::from(1)), false);

pub fn lambda<F: 'static + Fn(&Value) -> bool>(f: F) -> Self[src]

Creates a new predicate for Predicate::Lambda

Examples

use entity::{Predicate as P, Value as V};

let p = P::lambda(|v| v > &V::from(3));
assert_eq!(p.check(&V::from(4)), true);
assert_eq!(p.check(&V::from(1)), false);

pub fn and<P: Into<Predicate>, I: IntoIterator<Item = P>>(i: I) -> Self[src]

Creates a new predicate for Predicate::And

Examples

use entity::{Predicate as P, Value as V};

let p = P::and(vec![
    P::greater_than(1),
    P::less_than(3),
]);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(1)), false);

pub fn not<P: Into<Predicate>>(p: P) -> Self[src]

Creates a new predicate for Predicate::Not

Examples

use entity::{Predicate as P, Value as V};

let p = P::not(P::greater_than(1));
assert_eq!(p.check(&V::from(1)), true);
assert_eq!(p.check(&V::from(2)), false);

pub fn or<P: Into<Predicate>, I: IntoIterator<Item = P>>(i: I) -> Self[src]

Creates a new predicate for Predicate::Or

Examples

use entity::{Predicate as P, Value as V};

let p = P::or(vec![P::greater_than(1), P::equals(1)]);
assert_eq!(p.check(&V::from(1)), true);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(0)), false);

pub fn xor<P: Into<Predicate>, I: IntoIterator<Item = P>>(i: I) -> Self[src]

Creates a new predicate for Predicate::Xor

Examples

use entity::{Predicate as P, Value as V};

let p = P::xor(vec![P::greater_than(1), P::greater_than(2)]);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(3)), false);
assert_eq!(p.check(&V::from(1)), false);

pub fn any<P: Into<Predicate>>(p: P) -> Self[src]

Creates a new predicate for Predicate::Any

Examples

use entity::{Predicate as P, Value as V};

let p = P::any(P::equals(3));
assert_eq!(p.check(&V::from(vec![1, 2, 3])), true);

let p = P::any(P::equals(4));
assert_eq!(p.check(&V::from(vec![1, 2, 3])), false);

pub fn contains<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::Contains

Examples

use entity::{Predicate as P, Value as V};

let p = P::contains(3);
assert_eq!(p.check(&V::from(vec![1, 2, 3])), true);

let p = P::contains(4);
assert_eq!(p.check(&V::from(vec![1, 2, 3])), false);

pub fn contains_all<T: ValueLike, I: IntoIterator<Item = T>>(i: I) -> Self[src]

Creates a new predicate for Predicate::ContainsAll

Examples

use entity::{Predicate as P, Value as V};

let p = P::contains_all(vec![1, 3]);
assert_eq!(p.check(&V::from(vec![1, 2, 3])), true);

let p = P::contains_all(vec![1, 4]);
assert_eq!(p.check(&V::from(vec![1, 2, 3])), false);

pub fn contains_any<T: ValueLike, I: IntoIterator<Item = T>>(i: I) -> Self[src]

Creates a new predicate for Predicate::ContainsAny

Examples

use entity::{Predicate as P, Value as V};

let p = P::contains_any(vec![1, 4]);
assert_eq!(p.check(&V::from(vec![1, 2, 3])), true);

let p = P::contains_any(vec![4, 5]);
assert_eq!(p.check(&V::from(vec![1, 2, 3])), false);

pub fn equals<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::Equals

Examples

use entity::{Predicate as P, Value as V};

let p = P::equals(3);
assert_eq!(p.check(&V::from(3)), true);
assert_eq!(p.check(&V::from(2)), false);

pub fn greater_than<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::GreaterThan

Examples

use entity::{Predicate as P, Value as V};

let p = P::greater_than(3);
assert_eq!(p.check(&V::from(4)), true);
assert_eq!(p.check(&V::from(3)), false);

pub fn greater_than_or_equals<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::GreaterThanOrEquals

Examples

use entity::{Predicate as P, Value as V};

let p = P::greater_than_or_equals(3);
assert_eq!(p.check(&V::from(4)), true);
assert_eq!(p.check(&V::from(3)), true);
assert_eq!(p.check(&V::from(2)), false);

pub fn in_range<T: ValueLike>(range: RangeInclusive<T>) -> Self[src]

Creates a new predicate for Predicate::InRange

Examples

use entity::{Predicate as P, Value as V};

let p = P::in_range(3..=5);
assert_eq!(p.check(&V::from(2)), false);
assert_eq!(p.check(&V::from(3)), true);
assert_eq!(p.check(&V::from(4)), true);
assert_eq!(p.check(&V::from(5)), true);
assert_eq!(p.check(&V::from(6)), false);

pub fn in_set<T: ValueLike, I: IntoIterator<Item = T>>(set: I) -> Self[src]

Creates a new predicate for Predicate::InSet

Examples

use entity::{Predicate as P, Value as V};

let p = P::in_set(vec![1, 2, 3]);
assert_eq!(p.check(&V::from(0)), false);
assert_eq!(p.check(&V::from(1)), true);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(3)), true);
assert_eq!(p.check(&V::from(4)), false);

pub fn less_than<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::LessThan

Examples

use entity::{Predicate as P, Value as V};

let p = P::less_than(3);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(3)), false);

pub fn less_than_or_equals<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::LessThanOrEquals

Examples

use entity::{Predicate as P, Value as V};

let p = P::less_than_or_equals(3);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(3)), true);
assert_eq!(p.check(&V::from(4)), false);

pub fn not_equals<T: ValueLike>(value: T) -> Self[src]

Creates a new predicate for Predicate::NotEquals

use entity::{Predicate as P, Value as V};

let p = P::not_equals(3);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(3)), false);

pub fn not_in_range<T: ValueLike>(range: RangeInclusive<T>) -> Self[src]

Creates a new predicate for Predicate::NotInRange

Examples

use entity::{Predicate as P, Value as V};

let p = P::not_in_range(3..=5);
assert_eq!(p.check(&V::from(2)), true);
assert_eq!(p.check(&V::from(3)), false);
assert_eq!(p.check(&V::from(4)), false);
assert_eq!(p.check(&V::from(5)), false);
assert_eq!(p.check(&V::from(6)), true);

pub fn not_in_set<T: ValueLike, I: IntoIterator<Item = T>>(set: I) -> Self[src]

Creates a new predicate for Predicate::NotInSet

Examples

use entity::{Predicate as P, Value as V};

let p = P::not_in_set(vec![1, 2, 3]);
assert_eq!(p.check(&V::from(0)), true);
assert_eq!(p.check(&V::from(1)), false);
assert_eq!(p.check(&V::from(2)), false);
assert_eq!(p.check(&V::from(3)), false);
assert_eq!(p.check(&V::from(4)), true);

pub fn has_key<K: Into<String>>(k: K) -> Self[src]

Creates a new predicate for Predicate::HasKey

Examples

use entity::{Predicate as P, Value as V};
use std::collections::HashMap;

let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();

let p = P::has_key("a");
assert_eq!(p.check(&V::from(map.clone())), true);

let p = P::has_key("d");
assert_eq!(p.check(&V::from(map)), false);

pub fn has_key_where_value<K: Into<String>, P: Into<Predicate>>(
    k: K,
    p: P
) -> Self
[src]

Creates a new typed predicate for Predicate::HasKeyWhereValue

Examples

use entity::{Predicate as P, Value as V};
use std::collections::HashMap;

let map: HashMap<String, u32> = vec![
    (String::from("a"), 1),
    (String::from("b"), 2),
    (String::from("c"), 3),
].into_iter().collect();

let p = P::has_key_where_value("a", P::equals(1));
assert_eq!(p.check(&V::from(map.clone())), true);

let p = P::has_key_where_value("b", P::equals(1));
assert_eq!(p.check(&V::from(map.clone())), false);

let p = P::has_key_where_value("d", P::equals(1));
assert_eq!(p.check(&V::from(map)), false);

pub fn is_none() -> Self[src]

Creates a new predicate for Predicate::IsNone

Examples

use entity::{Predicate as P, Value as V};

let p = P::is_none();
assert_eq!(p.check(&V::from(None::<u32>)), true);
assert_eq!(p.check(&V::from(Some(3))), false);

pub fn not_none_and<P: Into<Predicate>>(p: P) -> Self[src]

Creates a new predicate for Predicate::NotNoneAnd

Examples

use entity::{Predicate as P, Value as V};

let p = P::not_none_and(P::equals(3));
assert_eq!(p.check(&V::from(Some(3))), true);
assert_eq!(p.check(&V::from(Some(2))), false);
assert_eq!(p.check(&V::from(None::<u32>)), false);

pub fn none_or<P: Into<Predicate>>(p: P) -> Self[src]

Creates a new predicate for Predicate::NoneOr

Examples

use entity::{Predicate as P, Value as V};

let p = P::none_or(P::equals(3));
assert_eq!(p.check(&V::from(Some(3))), true);
assert_eq!(p.check(&V::from(None::<u32>)), true);
assert_eq!(p.check(&V::from(Some(2))), false);

pub fn text_ends_with<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextEndsWith

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_ends_with("text");

assert_eq!(p.check(&V::from("some text")), true);
assert_eq!(p.check(&V::from("text some")), false);

pub fn text_ends_with_case_insensitive<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextEndsWithCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_ends_with_case_insensitive("text");

assert_eq!(p.check(&V::from("SOME TEXT")), true);
assert_eq!(p.check(&V::from("TEXT SOME")), false);

pub fn text_equals_case_insensitive<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextEqualsCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_equals_case_insensitive("text");

assert_eq!(p.check(&V::from("TEXT")), true);
assert_eq!(p.check(&V::from("OTHER")), false);

pub fn text_in_set_case_insensitive<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextInSetCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_in_set_case_insensitive(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("TWO")), true);
assert_eq!(p.check(&V::from("FOUR")), false);

pub fn text_not_equals_case_insensitive<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextNotEqualsCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_not_equals_case_insensitive("text");

assert_eq!(p.check(&V::from("OTHER")), true);
assert_eq!(p.check(&V::from("TEXT")), false);

pub fn text_starts_with<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextStartsWith

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_starts_with("text");

assert_eq!(p.check(&V::from("text some")), true);
assert_eq!(p.check(&V::from("some text")), false);

pub fn text_starts_with_case_insensitive<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextStartsWithCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_starts_with_case_insensitive("text");

assert_eq!(p.check(&V::from("TEXT SOME")), true);
assert_eq!(p.check(&V::from("SOME TEXT")), false);

pub fn text_contained_in<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextContainedIn

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_contained_in("text");

assert_eq!(p.check(&V::from("ex")), true);
assert_eq!(p.check(&V::from("tt")), false);

pub fn text_contained_in_case_insensitive<S: Into<String>>(s: S) -> Self[src]

Creates a new predicate for Predicate::TextContainedInCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_contained_in_case_insensitive("text");

assert_eq!(p.check(&V::from("EX")), true);
assert_eq!(p.check(&V::from("TT")), false);

pub fn text_contains_all<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextContainsAll

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_contains_all(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("my one and two and three text")), true);
assert_eq!(p.check(&V::from("my one and two text")), false);

pub fn text_contains_all_case_insensitive<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextContainsAllCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_contains_all_case_insensitive(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("MY ONE AND TWO AND THREE TEXT")), true);
assert_eq!(p.check(&V::from("MY ONE AND TWO TEXT")), false);

pub fn text_contains_any<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextContainsAny

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_contains_any(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("my one text")), true);
assert_eq!(p.check(&V::from("my four text")), false);

pub fn text_contains_any_case_insensitive<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextContainsAnyCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_contains_any_case_insensitive(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("MY ONE TEXT")), true);
assert_eq!(p.check(&V::from("MY FOUR TEXT")), false);

pub fn text_ends_with_any<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextEndsWithAny

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_ends_with_any(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("my text one")), true);
assert_eq!(p.check(&V::from("one my text")), false);

pub fn text_ends_with_any_case_insensitive<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextEndsWithAnyCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_ends_with_any_case_insensitive(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("MY TEXT ONE")), true);
assert_eq!(p.check(&V::from("ONE MY TEXT")), false);

pub fn text_starts_with_any<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextStartsWithAny

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_starts_with_any(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("one my text")), true);
assert_eq!(p.check(&V::from("my text one")), false);

pub fn text_starts_with_any_case_insensitive<S: Into<String>, I: IntoIterator<Item = S>>(
    i: I
) -> Self
[src]

Creates a new predicate for Predicate::TextStartsWithAnyCaseInsensitive

Examples

use entity::{Predicate as P, Value as V};

let p = P::text_starts_with_any_case_insensitive(vec!["one", "two", "three"]);

assert_eq!(p.check(&V::from("ONE MY TEXT")), true);
assert_eq!(p.check(&V::from("MY TEXT ONE")), false);

Trait Implementations

impl BitAnd<Predicate> for Predicate[src]

type Output = Self

The resulting type after applying the & operator.

fn bitand(self, rhs: Self) -> Self[src]

Shorthand to produce Predicate::And

Examples

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Equals(123.into_value()) & Predicate::Equals(124.into_value()),
    Predicate::And(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If the left-hand side is already a Predicate::And, the returned predicate will be an updated instance:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::And(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
    ]) & Predicate::Equals(124.into_value()),
    Predicate::And(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If the right-hand side is already a Predicate::And, the returned predicate will be an updated instance:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Equals(122.into_value()) & Predicate::And(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
    Predicate::And(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If both sides are already a Predicate::And, the returned predicate will be a merge:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::And(vec![
        Predicate::Equals(121.into_value()),
        Predicate::Equals(122.into_value()),
    ]) & Predicate::And(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
    Predicate::And(vec![
        Predicate::Equals(121.into_value()),
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

impl BitOr<Predicate> for Predicate[src]

type Output = Self

The resulting type after applying the | operator.

fn bitor(self, rhs: Self) -> Self[src]

Shorthand to produce Predicate::Or

Examples

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Equals(123.into_value()) | Predicate::Equals(124.into_value()),
    Predicate::Or(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If the left-hand side is already a Predicate::Or, the returned predicate will be an updated instance:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Or(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
    ]) | Predicate::Equals(124.into_value()),
    Predicate::Or(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If the right-hand side is already a Predicate::Or, the returned predicate will be an updated instance:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Equals(122.into_value()) | Predicate::Or(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
    Predicate::Or(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If both sides are already a Predicate::Or, the returned predicate will be a merge:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Or(vec![
        Predicate::Equals(121.into_value()),
        Predicate::Equals(122.into_value()),
    ]) | Predicate::Or(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
    Predicate::Or(vec![
        Predicate::Equals(121.into_value()),
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

impl BitXor<Predicate> for Predicate[src]

type Output = Self

The resulting type after applying the ^ operator.

fn bitxor(self, rhs: Self) -> Self[src]

Shorthand to produce Predicate::Xor

Examples

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Equals(123.into_value()) ^ Predicate::Equals(124.into_value()),
    Predicate::Xor(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If the left-hand side is already a Predicate::Xor, the returned predicate will be an updated instance:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Xor(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
    ]) ^ Predicate::Equals(124.into_value()),
    Predicate::Xor(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If the right-hand side is already a Predicate::Xor, the returned predicate will be an updated instance:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Equals(122.into_value()) ^ Predicate::Xor(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
    Predicate::Xor(vec![
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

If both sides are already a Predicate::Xor, the returned predicate will be a merge:

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    Predicate::Xor(vec![
        Predicate::Equals(121.into_value()),
        Predicate::Equals(122.into_value()),
    ]) ^ Predicate::Xor(vec![
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
    Predicate::Xor(vec![
        Predicate::Equals(121.into_value()),
        Predicate::Equals(122.into_value()),
        Predicate::Equals(123.into_value()),
        Predicate::Equals(124.into_value()),
    ]),
);

impl Clone for Predicate[src]

impl Debug for Predicate[src]

impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<MapTypedPredicate<T, C>> for Predicate[src]

impl<T: ValueLike> From<Predicate> for TypedPredicate<T>[src]

impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> From<Predicate> for MapTypedPredicate<T, C>[src]

impl<T: ValueLike> From<TypedPredicate<T>> for Predicate[src]

impl Not for Predicate[src]

type Output = Self

The resulting type after applying the ! operator.

fn not(self) -> Self::Output[src]

Shorthand to produce Predicate::Not

Examples

use entity::{Predicate, Value, ValueLike};

assert_eq!(
    !Predicate::Equals(123.into_value()),
    Predicate::Not(Box::new(Predicate::Equals(123.into_value()))),
);

impl PartialEq<Predicate> for Predicate[src]

impl<T: ValueLike> PartialEq<Predicate> for TypedPredicate<T>[src]

impl<T: ValueLike, C: IntoIterator<Item = (String, T)> + ValueLike> PartialEq<Predicate> for MapTypedPredicate<T, C>[src]

impl<T: ValueLike> PartialEq<TypedPredicate<T>> for Predicate[src]

Auto Trait Implementations

impl !RefUnwindSafe for Predicate

impl !Send for Predicate

impl !Sync for Predicate

impl Unpin for Predicate

impl !UnwindSafe for Predicate

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.