pub struct Predicate {
pub predicate_type: PredicateType,
pub entry: Entry,
}
Expand description
Used to compare database entries, e. g. in queries (fn find_*)
§Examples
use vdb::{Entry,Predicate};
let a = Entry::new_string("mundo", "world");
assert_eq!(a.compare(&Predicate::new_equal_string("mundo", "world")), true);
assert_eq!(a.compare(&Predicate::new_starts_with("mundo", "worl")), true);
assert_eq!(a.compare(&Predicate::new_contains("mundo", "orl")), true);
assert_eq!(a.compare(&Predicate::new_equal_string("mundo", "planet")), false);
Fields§
§predicate_type: PredicateType
§entry: Entry
Implementations§
Source§impl Predicate
impl Predicate
Sourcepub fn new_equal_i32(name: &str, value: i32) -> Predicate
pub fn new_equal_i32(name: &str, value: i32) -> Predicate
Shortcut for creating a new Predicate
that tests for equality with a DbI32
Sourcepub fn new_any_string(name: &str) -> Predicate
pub fn new_any_string(name: &str) -> Predicate
Shortcut for creating a new Predicate
that searches database for DbString
s equal to
value
Sourcepub fn new_equal_string(name: &str, value: &str) -> Predicate
pub fn new_equal_string(name: &str, value: &str) -> Predicate
Shortcut for creating a new Predicate
that searches database for DbString
s equal to
value
Sourcepub fn new_starts_with(name: &str, value: &str) -> Predicate
pub fn new_starts_with(name: &str, value: &str) -> Predicate
Shortcut for creating a new Predicate
that searches database for DbString
s starting
with value
Sourcepub fn new_contains(name: &str, value: &str) -> Predicate
pub fn new_contains(name: &str, value: &str) -> Predicate
Shortcut for creating a new Predicate
that searches database for DbString
s that contain
value
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Predicate
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnwindSafe for Predicate
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