pub struct UnitSet(/* private fields */);Expand description
The set of units composing one island. Stored sorted + deduped so
UnitSet::intersects is a linear merge — the check the “no two
Active claims share a unit” property leans on once gangs span
islands (Phase C/D).
Implementations§
Source§impl UnitSet
impl UnitSet
Sourcepub fn new(units: Vec<UnitId>) -> Self
pub fn new(units: Vec<UnitId>) -> Self
Build a UnitSet from arbitrary unit ids, normalizing to
sorted + deduped order.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of distinct units in the island — the axis a min_units
numeric filter compares against.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Is the island empty (no units)? Such a record is malformed; the
numeric filter rejects it under any positive min_units.
Sourcepub fn intersects(&self, other: &UnitSet) -> bool
pub fn intersects(&self, other: &UnitSet) -> bool
Do these two islands share any unit? Both vecs are sorted, so this is an O(n+m) merge, not a nested scan.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UnitSet
impl<'de> Deserialize<'de> for UnitSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for UnitSet
impl StructuralPartialEq for UnitSet
Auto Trait Implementations§
impl Freeze for UnitSet
impl RefUnwindSafe for UnitSet
impl Send for UnitSet
impl Sync for UnitSet
impl Unpin for UnitSet
impl UnsafeUnpin for UnitSet
impl UnwindSafe for UnitSet
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.