[−][src]Struct codd::expression::Project
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]
S: Tuple,
T: Tuple,
E: Expression<S>,
pub fn new<I>(expression: I, mapper: impl FnMut(&S) -> T + 'static) -> Self where
I: IntoExpression<S, E>,
[src]
I: IntoExpression<S, E>,
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]
S: Tuple,
T: Tuple,
E: Expression<S>,
impl<S, T, E> Debug for Project<S, T, E> where
S: Tuple,
T: Tuple,
E: Expression<S>,
[src]
S: Tuple,
T: Tuple,
E: Expression<S>,
impl<S, T, E> Expression<T> for Project<S, T, E> where
S: Tuple,
T: Tuple,
E: Expression<S>,
[src]
S: Tuple,
T: Tuple,
E: Expression<S>,
fn visit<V>(&self, visitor: &mut V) where
V: Visitor,
[src]
V: Visitor,
fn builder(&self) -> Builder<T, Self>
[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,
E: Unpin,
impl<S, T, E> !UnwindSafe for Project<S, T, E>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, E> IntoExpression<T, E> for E where
E: Expression<T>,
T: Tuple,
[src]
E: Expression<T>,
T: Tuple,
pub fn into_expression(Self) -> E
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,