[][src]Struct vdb::Predicate

pub struct Predicate {
    pub predicate_type: PredicateType,
    pub entry: Entry,
}

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: PredicateTypeentry: Entry

Methods

impl Predicate[src]

pub fn new_equal_i32(name: &str, value: i32) -> Predicate[src]

Shortcut for creating a new Predicate that tests for equality with a DbI32

pub fn new_any_string(name: &str) -> Predicate[src]

Shortcut for creating a new Predicate that searches database for DbStrings equal to value

pub fn new_equal_string(name: &str, value: &str) -> Predicate[src]

Shortcut for creating a new Predicate that searches database for DbStrings equal to value

pub fn new_starts_with(name: &str, value: &str) -> Predicate[src]

Shortcut for creating a new Predicate that searches database for DbStrings starting with value

pub fn new_contains(name: &str, value: &str) -> Predicate[src]

Shortcut for creating a new Predicate that searches database for DbStrings that contain value

Trait Implementations

impl Debug for Predicate[src]

Auto Trait Implementations

Blanket Implementations

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

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

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.

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

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

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