pub struct CompartmentSet(pub u64);Expand description
A fixed bitset of compartment bits — the powerset-lattice axis, packed so
SecurityLabel stays Copy + Ord + Hash.
Bit i set ⟺ the label is in the compartment interned at index i by the
policy. Subset/union are bitwise AND/OR. The empty set (0) is the
compartment-axis bottom. This is the representation that lets S4’s AVC (#570)
key on a label with no interning indirection.
Tuple Fields§
§0: u64Implementations§
Source§impl CompartmentSet
impl CompartmentSet
Sourcepub const EMPTY: CompartmentSet
pub const EMPTY: CompartmentSet
The empty compartment set — the axis bottom.
Sourcepub const fn single(index: u32) -> CompartmentSet
pub const fn single(index: u32) -> CompartmentSet
A set containing exactly the single bit index (0 ≤ index <
MAX_COMPARTMENTS). Out-of-range indices are ignored (empty) —
fail-closed: an un-representable compartment grants nothing.
Sourcepub const fn is_subset(self, other: CompartmentSet) -> bool
pub const fn is_subset(self, other: CompartmentSet) -> bool
self ⊆ other — is every compartment of self also in other?
Sourcepub const fn union(self, other: CompartmentSet) -> CompartmentSet
pub const fn union(self, other: CompartmentSet) -> CompartmentSet
Set union (the IFC join on this axis).
Sourcepub const fn intersect(self, other: CompartmentSet) -> CompartmentSet
pub const fn intersect(self, other: CompartmentSet) -> CompartmentSet
Set intersection (the lattice meet on this axis) — the dual of
Self::union. Used to compose the need-to-know of two principals
(#681 delegated meet): the result is cleared into a compartment only if
both inputs are, so a delegated call never widens need-to-know past
either principal.
Trait Implementations§
Source§impl Clone for CompartmentSet
impl Clone for CompartmentSet
Source§fn clone(&self) -> CompartmentSet
fn clone(&self) -> CompartmentSet
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 CompartmentSet
impl Debug for CompartmentSet
Source§impl Default for CompartmentSet
impl Default for CompartmentSet
Source§fn default() -> CompartmentSet
fn default() -> CompartmentSet
Source§impl<'de> Deserialize<'de> for CompartmentSet
impl<'de> Deserialize<'de> for CompartmentSet
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CompartmentSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CompartmentSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl FromIterator<u32> for CompartmentSet
impl FromIterator<u32> for CompartmentSet
Source§fn from_iter<I>(iter: I) -> CompartmentSetwhere
I: IntoIterator<Item = u32>,
fn from_iter<I>(iter: I) -> CompartmentSetwhere
I: IntoIterator<Item = u32>,
Source§impl Hash for CompartmentSet
impl Hash for CompartmentSet
Source§impl Ord for CompartmentSet
impl Ord for CompartmentSet
Source§fn cmp(&self, other: &CompartmentSet) -> Ordering
fn cmp(&self, other: &CompartmentSet) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for CompartmentSet
impl PartialEq for CompartmentSet
Source§fn eq(&self, other: &CompartmentSet) -> bool
fn eq(&self, other: &CompartmentSet) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for CompartmentSet
impl PartialOrd for CompartmentSet
Source§impl Serialize for CompartmentSet
impl Serialize for CompartmentSet
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for CompartmentSet
impl Eq for CompartmentSet
impl StructuralPartialEq for CompartmentSet
Auto Trait Implementations§
impl Freeze for CompartmentSet
impl RefUnwindSafe for CompartmentSet
impl Send for CompartmentSet
impl Sync for CompartmentSet
impl Unpin for CompartmentSet
impl UnsafeUnpin for CompartmentSet
impl UnwindSafe for CompartmentSet
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request