[−][src]Struct codd::expression::Product
Corresponds to the cartesian product of two expression.
Example:
use codd::{Database, expression::Product}; 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 prod = Product::new(&r, &s, |l, r| l*r); assert_eq!(vec![0, 2, 4, 8], db.evaluate(&prod).unwrap().into_tuples());
Implementations
impl<L, R, Left, Right, T> Product<L, R, Left, Right, T> where
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
pub fn new<IL, IR>(
left: IL,
right: IR,
project: impl FnMut(&L, &R) -> T + 'static
) -> Self where
IL: IntoExpression<L, Left>,
IR: IntoExpression<R, Right>,
[src]
left: IL,
right: IR,
project: impl FnMut(&L, &R) -> T + 'static
) -> Self where
IL: IntoExpression<L, Left>,
IR: IntoExpression<R, Right>,
Creates a Product
expression over left
and right
with mapper
as the closure
that produces the tuples of the resulting expression from 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.
pub fn mapper_mut(&self) -> RefMut<'_, dyn FnMut(&L, &R) -> T>
[src]
Returns a mutable reference (of type std::cell::RefMut
) to the mapping closure.
Trait Implementations
impl<L: Clone, R: Clone, Left: Clone, Right: Clone, T: Clone> Clone for Product<L, R, Left, Right, T> where
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
fn clone(&self) -> Product<L, R, Left, Right, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<L, R, Left, Right, T> Debug for Product<L, R, Left, Right, T> where
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
impl<L, R, Left, Right, T> Expression<T> for Product<L, R, Left, Right, T> where
L: Tuple,
R: Tuple,
T: Tuple,
Left: Expression<L>,
Right: Expression<R>,
[src]
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<Product<T, T, Mono<T>, Mono<T>, T>> for Mono<T>
[src]
Auto Trait Implementations
impl<L, R, Left, Right, T> !RefUnwindSafe for Product<L, R, Left, Right, T>
impl<L, R, Left, Right, T> !Send for Product<L, R, Left, Right, T>
impl<L, R, Left, Right, T> !Sync for Product<L, R, Left, Right, T>
impl<L, R, Left, Right, T> Unpin for Product<L, R, Left, Right, T> where
Left: Unpin,
Right: Unpin,
Left: Unpin,
Right: Unpin,
impl<L, R, Left, Right, T> !UnwindSafe for Product<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>,