pub struct FieldSet { /* private fields */ }Expand description
A set of field IDs implemented as a dynamically-sized bitset.
Used by propagators to declare which fields they read and write, enabling the engine to validate the dependency graph and compute overlay resolution plans.
§Examples
use murk_core::{FieldSet, FieldId};
let mut set = FieldSet::empty();
set.insert(FieldId(0));
set.insert(FieldId(3));
assert!(set.contains(FieldId(0)));
assert!(!set.contains(FieldId(1)));
// Collect all IDs.
let ids: Vec<_> = set.iter().collect();
assert_eq!(ids, vec![FieldId(0), FieldId(3)]);Implementations§
Source§impl FieldSet
impl FieldSet
Sourcepub fn union(&self, other: &Self) -> Self
pub fn union(&self, other: &Self) -> Self
Return the union of two sets (self | other).
§Examples
use murk_core::{FieldSet, FieldId};
let a: FieldSet = [FieldId(0), FieldId(1)].into_iter().collect();
let b: FieldSet = [FieldId(1), FieldId(2)].into_iter().collect();
let u = a.union(&b);
assert_eq!(u.len(), 3);
assert!(u.contains(FieldId(0)));
assert!(u.contains(FieldId(1)));
assert!(u.contains(FieldId(2)));Sourcepub fn intersection(&self, other: &Self) -> Self
pub fn intersection(&self, other: &Self) -> Self
Return the intersection of two sets (self & other).
§Examples
use murk_core::{FieldSet, FieldId};
let a: FieldSet = [FieldId(0), FieldId(1)].into_iter().collect();
let b: FieldSet = [FieldId(1), FieldId(2)].into_iter().collect();
let inter = a.intersection(&b);
assert_eq!(inter.len(), 1);
assert!(inter.contains(FieldId(1)));Sourcepub fn difference(&self, other: &Self) -> Self
pub fn difference(&self, other: &Self) -> Self
Return the set difference (self - other): elements in self but not other.
§Examples
use murk_core::{FieldSet, FieldId};
let a: FieldSet = [FieldId(0), FieldId(1), FieldId(2)].into_iter().collect();
let b: FieldSet = [FieldId(1)].into_iter().collect();
let diff = a.difference(&b);
assert_eq!(diff.len(), 2);
assert!(diff.contains(FieldId(0)));
assert!(!diff.contains(FieldId(1)));
assert!(diff.contains(FieldId(2)));Sourcepub fn iter(&self) -> FieldSetIter<'_> ⓘ
pub fn iter(&self) -> FieldSetIter<'_> ⓘ
Iterate over the field IDs in the set, in ascending order.
Trait Implementations§
Source§impl FromIterator<FieldId> for FieldSet
impl FromIterator<FieldId> for FieldSet
Source§impl<'a> IntoIterator for &'a FieldSet
impl<'a> IntoIterator for &'a FieldSet
impl Eq for FieldSet
Auto Trait Implementations§
impl Freeze for FieldSet
impl RefUnwindSafe for FieldSet
impl Send for FieldSet
impl Sync for FieldSet
impl Unpin for FieldSet
impl UnwindSafe for FieldSet
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