[][src]Struct codd::expression::Project

pub struct Project<S, T, E> where
    S: Tuple,
    T: Tuple,
    E: Expression<S>, 
{ /* fields omitted */ }

Projects the tuples of an inner sub-expression of type S to tuples of type T.

Example:

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

let mut db = Database::new();
let fruit = db.add_relation::<String>("R").unwrap();

db.insert(&fruit, vec!["Apple".to_string(), "BANANA".to_string(), "cherry".to_string()].into());

let lower = Project::new(
    &fruit,
    |t| t.to_lowercase(), // projecting closure
);

assert_eq!(vec!["apple", "banana", "cherry"], db.evaluate(&lower).unwrap().into_tuples());

Implementations

impl<S, T, E> Project<S, T, E> where
    S: Tuple,
    T: Tuple,
    E: Expression<S>, 
[src]

pub fn new<I>(expression: I, mapper: impl FnMut(&S) -> T + 'static) -> Self where
    I: IntoExpression<S, E>, 
[src]

Creates a new Project expression over expression with a closure mapper that projects tuples of expression to the resulting tuples.

pub fn expression(&self) -> &E[src]

Returns a reference to the underlying sub-expression.

Trait Implementations

impl<S: Clone, T: Clone, E: Clone> Clone for Project<S, T, E> where
    S: Tuple,
    T: Tuple,
    E: Expression<S>, 
[src]

impl<S, T, E> Debug for Project<S, T, E> where
    S: Tuple,
    T: Tuple,
    E: Expression<S>, 
[src]

impl<S, T, E> Expression<T> for Project<S, T, E> where
    S: Tuple,
    T: Tuple,
    E: Expression<S>, 
[src]

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

Auto Trait Implementations

impl<S, T, E> !RefUnwindSafe for Project<S, T, E>

impl<S, T, E> !Send for Project<S, T, E>

impl<S, T, E> !Sync for Project<S, T, E>

impl<S, T, E> Unpin for Project<S, T, E> where
    E: Unpin

impl<S, T, E> !UnwindSafe for Project<S, T, E>

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.