[−][src]Struct codd::expression::View
Represents a view in the database.
Example:
use codd::{Database, expression::{Product, View}}; let mut db = Database::new(); let dividends = db.add_relation("dividends").unwrap(); let divisors = db.add_relation("divisors").unwrap(); db.insert(÷nds, vec![6, 12, 18].into()).unwrap(); db.insert(&divisors, vec![2, 3].into()).unwrap(); // divide all elements of `dividends` by all elements of `divisors`: let quotients = Product::new( dividends.clone(), divisors.clone(), |&l, &r| l/r ); let view = db.store_view(quotients.clone()).unwrap(); // `view` and `quotients` evaluate to the same result: assert_eq!(vec![2, 3, 4, 6, 9], db.evaluate("ients).unwrap().into_tuples()); assert_eq!(vec![2, 3, 4, 6, 9], db.evaluate(&view).unwrap().into_tuples()); db.insert(÷nds, vec![24, 30].into()); db.insert(&divisors, vec![1].into()); // the view gets updated automatically: assert_eq!( vec![2, 3, 4, 6, 8, 9, 10, 12, 15, 18, 24, 30], db.evaluate(&view).unwrap().into_tuples() ); use codd::expression::Difference; // incremental view update for `Difference` is currently not supported: assert!(db.store_view(Difference::new(dividends, divisors)).is_err());
Trait Implementations
impl<T: Clone, E: Clone> Clone for View<T, E> where
T: Tuple,
E: Expression<T>,
[src]
T: Tuple,
E: Expression<T>,
impl<T: Debug, E: Debug> Debug for View<T, E> where
T: Tuple,
E: Expression<T>,
[src]
T: Tuple,
E: Expression<T>,
impl<T: Eq, E: Eq> Eq for View<T, E> where
T: Tuple,
E: Expression<T>,
[src]
T: Tuple,
E: Expression<T>,
impl<T, E> Expression<T> for View<T, E> where
T: Tuple + 'static,
E: Expression<T> + 'static,
[src]
T: Tuple + 'static,
E: Expression<T> + 'static,
fn visit<V>(&self, visitor: &mut V) where
V: Visitor,
[src]
V: Visitor,
fn builder(&self) -> Builder<T, Self>
[src]
impl<T: Tuple> From<View<T, Mono<T>>> for Mono<T>
[src]
impl<T: PartialEq, E: PartialEq> PartialEq<View<T, E>> for View<T, E> where
T: Tuple,
E: Expression<T>,
[src]
T: Tuple,
E: Expression<T>,
impl<T, E> StructuralEq for View<T, E> where
T: Tuple,
E: Expression<T>,
[src]
T: Tuple,
E: Expression<T>,
impl<T, E> StructuralPartialEq for View<T, E> where
T: Tuple,
E: Expression<T>,
[src]
T: Tuple,
E: Expression<T>,
Auto Trait Implementations
impl<T, E> RefUnwindSafe for View<T, E> where
E: RefUnwindSafe,
T: RefUnwindSafe,
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, E> Send for View<T, E> where
E: Send,
T: Send,
E: Send,
T: Send,
impl<T, E> Sync for View<T, E> where
E: Sync,
T: Sync,
E: Sync,
T: Sync,
impl<T, E> Unpin for View<T, E> where
E: Unpin,
T: Unpin,
E: Unpin,
T: Unpin,
impl<T, E> UnwindSafe for View<T, E> where
E: UnwindSafe,
T: UnwindSafe,
E: UnwindSafe,
T: UnwindSafe,
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>,