Function canrun::collections::lmap::subset
source · pub fn subset<K, V, A, B>(a: A, b: B) -> impl Goalwhere
K: Unify + Eq + Hash + Debug,
V: Unify + Debug,
A: Into<Value<LMap<K, V>>>,
B: Into<Value<LMap<K, V>>>,
Expand description
Assert that LMap
a
is a subset of LMap
b
.
This means that all of the keys in a
unify with keys in b
AND the
corresponding values also unify. This is the opposite of superset
.
Example:
use canrun::{LVar, Query};
use canrun::lmap::{lmap, subset};
let x = LVar::new();
let goal = subset(lmap! {x => 2}, lmap! {1 => 2, 3 => 4});
let results: Vec<_> = goal.query(x).collect();
assert_eq!(results, vec![1]);