pub struct ToolErrorKindSet(/* private fields */);Expand description
Compact set of ToolErrorKind values. Backed by a fixed-width
integer bitset — every variant occupies one bit at a stable
position determined by the enum taxonomy.
The type lives next to ToolErrorKind rather than in a
dedicated set module so the bit layout and the enum stay in
one place. The bit_indices_are_unique_and_fit_in_set_width
regression test below uses a same-crate exhaustive match to
force every new variant through a uniqueness + width check —
landing a variant whose bit_index exceeds the set width fails
the test, and the developer widens the backing integer in
lockstep with the taxonomy.
Construction is const-friendly — operator defaults and unit
tests build sets at compile time:
use entelix_core::tools::{ToolErrorKind, ToolErrorKindSet};
const SAFE: ToolErrorKindSet = ToolErrorKindSet::empty()
.with(ToolErrorKind::Auth)
.with(ToolErrorKind::Quota)
.with(ToolErrorKind::Permanent);
assert!(SAFE.contains(ToolErrorKind::Auth));
assert!(!SAFE.contains(ToolErrorKind::Transient));Implementations§
Source§impl ToolErrorKindSet
impl ToolErrorKindSet
Sourcepub const fn singleton(kind: ToolErrorKind) -> Self
pub const fn singleton(kind: ToolErrorKind) -> Self
Single-kind set — useful at literal call sites.
Sourcepub const fn with(self, kind: ToolErrorKind) -> Self
pub const fn with(self, kind: ToolErrorKind) -> Self
Insert kind into the set, returning the updated set.
Sourcepub const fn without(self, kind: ToolErrorKind) -> Self
pub const fn without(self, kind: ToolErrorKind) -> Self
Remove kind from the set, returning the updated set.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
Union with another set, returning the updated set.
Sourcepub const fn contains(self, kind: ToolErrorKind) -> bool
pub const fn contains(self, kind: ToolErrorKind) -> bool
Whether kind is in the set.
Trait Implementations§
Source§impl Clone for ToolErrorKindSet
impl Clone for ToolErrorKindSet
Source§fn clone(&self) -> ToolErrorKindSet
fn clone(&self) -> ToolErrorKindSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolErrorKindSet
impl Debug for ToolErrorKindSet
Source§impl Default for ToolErrorKindSet
impl Default for ToolErrorKindSet
Source§fn default() -> ToolErrorKindSet
fn default() -> ToolErrorKindSet
Source§impl Hash for ToolErrorKindSet
impl Hash for ToolErrorKindSet
Source§impl PartialEq for ToolErrorKindSet
impl PartialEq for ToolErrorKindSet
Source§fn eq(&self, other: &ToolErrorKindSet) -> bool
fn eq(&self, other: &ToolErrorKindSet) -> bool
self and other values to be equal, and is used by ==.impl Copy for ToolErrorKindSet
impl Eq for ToolErrorKindSet
impl StructuralPartialEq for ToolErrorKindSet
Auto Trait Implementations§
impl Freeze for ToolErrorKindSet
impl RefUnwindSafe for ToolErrorKindSet
impl Send for ToolErrorKindSet
impl Sync for ToolErrorKindSet
impl Unpin for ToolErrorKindSet
impl UnsafeUnpin for ToolErrorKindSet
impl UnwindSafe for ToolErrorKindSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key and return true if they are equal.