[][src]Struct codd::expression::Difference

pub struct Difference<T, L, R> where
    T: Tuple,
    L: Expression<T>,
    R: Expression<T>, 
{ /* fields omitted */ }

Evaluates to the tuples that are in its left but not in its right sub-expressions (left - right).

Example:

use codd::{Database, expression::Difference};

let mut db = Database::new();
let r = db.add_relation::<i32>("R").unwrap();
let s = db.add_relation::<i32>("S").unwrap();

db.insert(&r, vec![0, 1, 2].into());
db.insert(&s, vec![2, 4].into());

let r_s = Difference::new(&r, &s);
let s_r = Difference::new(&s, &r);

assert_eq!(vec![0, 1], db.evaluate(&r_s).unwrap().into_tuples());
assert_eq!(vec![4], db.evaluate(&s_r).unwrap().into_tuples());

Implementations

impl<T, L, R> Difference<T, L, R> where
    T: Tuple,
    L: Expression<T>,
    R: Expression<T>, 
[src]

pub fn new<IL, IR>(left: IL, right: IR) -> Self where
    IL: IntoExpression<T, L>,
    IR: IntoExpression<T, R>, 
[src]

Creates a new instance of Difference corresponding to left - right.

pub fn left(&self) -> &L[src]

Returns a reference to the left sub-expression.

pub fn right(&self) -> &R[src]

Returns a reference to the right sub-expression.

Trait Implementations

impl<T: Clone, L: Clone, R: Clone> Clone for Difference<T, L, R> where
    T: Tuple,
    L: Expression<T>,
    R: Expression<T>, 
[src]

impl<T: Debug, L: Debug, R: Debug> Debug for Difference<T, L, R> where
    T: Tuple,
    L: Expression<T>,
    R: Expression<T>, 
[src]

impl<T, L, R> Expression<T> for Difference<T, L, R> where
    T: Tuple,
    L: Expression<T>,
    R: Expression<T>, 
[src]

impl<T: Tuple> From<Difference<T, Mono<T>, Mono<T>>> for Mono<T>[src]

Auto Trait Implementations

impl<T, L, R> RefUnwindSafe for Difference<T, L, R> where
    L: RefUnwindSafe,
    R: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, L, R> Send for Difference<T, L, R> where
    L: Send,
    R: Send,
    T: Send

impl<T, L, R> Sync for Difference<T, L, R> where
    L: Sync,
    R: Sync,
    T: Sync

impl<T, L, R> Unpin for Difference<T, L, R> where
    L: Unpin,
    R: Unpin,
    T: Unpin

impl<T, L, R> UnwindSafe for Difference<T, L, R> where
    L: UnwindSafe,
    R: UnwindSafe,
    T: UnwindSafe

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> From<T> for T[src]

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

impl<T, E> IntoExpression<T, E> for E where
    E: Expression<T>,
    T: Tuple
[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.