pub struct Relation<C: Op_> { /* private fields */ }

Implementations

Simplifies the inferred type-signature of a relation at the cost of requiring dynamic dispatch at runtime.

Try inserting this in the middle of a big relation if the compiler is running slowly or using up too much memory.

Splits a collection of 2-tuples into a 2-tuple of collections.

Example:

   use standing_relations::CreationContext;
   use std::{collections::HashMap, iter::FromIterator};

   let mut context = CreationContext::new();
   let (mut foo_input, foo) = context.new_input::<usize>();
   let (evens, odds) = foo.map(|x| (x * 2, x * 2 + 1)).split();
   let evens = evens.into_output(&context);
   let odds = odds.into_output(&context);
    
   let mut context = context.begin();
   foo_input.add_all(&context, 0 .. 2);
   context.commit();
   assert_eq!(&*evens.get(&context), &HashMap::from_iter(vec![(0,1),(2,1)]));
   assert_eq!(&*odds.get(&context), &HashMap::from_iter(vec![(1,1),(3,1)]));

No-op which nails down the expected item type.

The compiler will complain if the provided type is wrong. This helps you spot type errors where they occur rather than downstream.

Example:

   use standing_relations::CreationContext;
   use std::{collections::HashMap, iter::FromIterator};

   let mut context = CreationContext::new();
   let (_foo_input, foo) = context.new_input::<(char, isize)>();
   let (_bar_input, bar) = context.new_input::<char>();
   let foobar =
       foo.join(bar.counts()).flat_map(|(k,x,y)| if x < y {Some((k,x))} else {None});
   let foobar = foobar.t::<(char, isize)>();

Note that if instead of flat_map, we had accidentally used map, the compiler would complain because foobar would have item type Option<(char, isize)> where we expect (char, isize).

Retains only those keys which have count 0 in the argument relation.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.