pub struct Set {
pub authoritative: Arc<BTreeSet<Value>>,
pub fast: Option<Arc<HashSet<Literal>>>,
}
Expand description
Value
’s internal representation of a Set
Fields§
the values in the set, stored in a BTreeSet
fast: Option<Arc<HashSet<Literal>>>
if possible, HashSet<Literal>
representation of the set.
(This is possible if all the elements are literals.)
Some operations are much faster in this case.
INVARIANT (FastRepr)
we guarantee that if the elements are all
literals, then this will be Some
. (This allows us to further
optimize e.g. equality checks between sets: for instance, we know
that if one set has fast
and another does not, the sets can’t be
equal.)
Implementations§
Source§impl Set
impl Set
Sourcepub fn new(vals: impl IntoIterator<Item = Value>) -> Self
pub fn new(vals: impl IntoIterator<Item = Value>) -> Self
Create a set with the given Value
s as elements
Sourcepub fn from_lits(lits: impl IntoIterator<Item = Literal>) -> Self
pub fn from_lits(lits: impl IntoIterator<Item = Literal>) -> Self
Create a set with the given Literal
s as elements
Sourcepub fn is_disjoint(&self, other: &Set) -> bool
pub fn is_disjoint(&self, other: &Set) -> bool
Disjointness test
Trait Implementations§
Source§impl FromIterator<Literal> for Set
impl FromIterator<Literal> for Set
Source§impl FromIterator<Value> for Set
impl FromIterator<Value> for Set
Source§impl Ord for Set
impl Ord for Set
Source§impl PartialOrd for Set
impl PartialOrd for Set
impl Eq for Set
Auto Trait Implementations§
impl Freeze for Set
impl RefUnwindSafe for Set
impl Send for Set
impl Sync for Set
impl Unpin for Set
impl UnwindSafe for Set
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more