[−][src]Struct codd::expression::Join
Represents the join of its left
and right
sub-expressions.
Example:
use codd::{Database, expression::Join}; let mut db = Database::new(); let fruit = db.add_relation::<(i32, String)>("R").unwrap(); let numbers = db.add_relation::<i32>("S").unwrap(); db.insert(&fruit, vec![ (0, "Apple".to_string()), (1, "Banana".to_string()), (2, "Cherry".to_string()) ].into()); db.insert(&numbers, vec![0, 2].into()); let join = Join::new( &fruit, &numbers, |t| t.0, // first element of tuples in `r` is the key for join |&t| t, // the values in `s` are keys for join // make resulting values from key `k`, left value `l` and right value `r`: |k, l, r| format!("{}{}", l.1, k + r) ); assert_eq!(vec!["Apple0", "Cherry4"], db.evaluate(&join).unwrap().into_tuples());
Implementations
impl<K, L, R, Left, Right, T> Join<K, L, R, Left, Right, T> where
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
pub fn new<IL, IR>(
left: IL,
right: IR,
left_key: impl FnMut(&L) -> K + 'static,
right_key: impl FnMut(&R) -> K + 'static,
mapper: impl FnMut(&K, &L, &R) -> T + 'static
) -> Self where
IL: IntoExpression<L, Left>,
IR: IntoExpression<R, Right>,
[src]
left: IL,
right: IR,
left_key: impl FnMut(&L) -> K + 'static,
right_key: impl FnMut(&R) -> K + 'static,
mapper: impl FnMut(&K, &L, &R) -> T + 'static
) -> Self where
IL: IntoExpression<L, Left>,
IR: IntoExpression<R, Right>,
Creates a new Join
expression over left
and right
where left_key
and right_key
are closures that return the join key for tuples of
left
and right
respectively. The closure mapper
computes the tuples
of the resulting expression from the join key and the tuples of left
and
right
.
pub fn left(&self) -> &Left
[src]
Returns a reference to the left sub-expression.
pub fn right(&self) -> &Right
[src]
Returns a reference to the right sub-expression.
Trait Implementations
impl<K: Clone, L: Clone, R: Clone, Left: Clone, Right: Clone, T: Clone> Clone for Join<K, L, R, Left, Right, T> where
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
fn clone(&self) -> Join<K, L, R, Left, Right, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K, L, R, Left, Right, T> Debug for Join<K, L, R, Left, Right, T> where
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
impl<K, L, R, Left, Right, T> Expression<T> for Join<K, L, R, Left, Right, T> where
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
K: Tuple,
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
fn visit<V>(&self, visitor: &mut V) where
V: Visitor,
[src]
V: Visitor,
fn builder(&self) -> Builder<T, Self>
[src]
impl<T: Tuple> From<Join<T, T, T, Mono<T>, Mono<T>, T>> for Mono<T>
[src]
Auto Trait Implementations
impl<K, L, R, Left, Right, T> !RefUnwindSafe for Join<K, L, R, Left, Right, T>
impl<K, L, R, Left, Right, T> !Send for Join<K, L, R, Left, Right, T>
impl<K, L, R, Left, Right, T> !Sync for Join<K, L, R, Left, Right, T>
impl<K, L, R, Left, Right, T> Unpin for Join<K, L, R, Left, Right, T> where
Left: Unpin,
Right: Unpin,
Left: Unpin,
Right: Unpin,
impl<K, L, R, Left, Right, T> !UnwindSafe for Join<K, L, R, Left, Right, T>
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>,