pub enum SecurityLabel {
Low,
High,
}Expand description
A two-level security label for information flow control.
Low data can flow anywhere; High data must stay at High.
use fic::ast::SecurityLabel;
assert!(SecurityLabel::Low.flows_to(&SecurityLabel::High));
assert!(!SecurityLabel::High.flows_to(&SecurityLabel::Low));Variants§
Implementations§
Source§impl SecurityLabel
impl SecurityLabel
Sourcepub fn flows_to(&self, target: &SecurityLabel) -> bool
pub fn flows_to(&self, target: &SecurityLabel) -> bool
Check if information can flow from self to target.
- Low -> Low: OK
- Low -> High: OK (upward flow is safe)
- High -> High: OK
- High -> Low: rejected (information leak)
Trait Implementations§
Source§impl Clone for SecurityLabel
impl Clone for SecurityLabel
Source§fn clone(&self) -> SecurityLabel
fn clone(&self) -> SecurityLabel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecurityLabel
impl Debug for SecurityLabel
Source§impl Default for SecurityLabel
impl Default for SecurityLabel
Source§fn default() -> SecurityLabel
fn default() -> SecurityLabel
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SecurityLabel
impl<'de> Deserialize<'de> for SecurityLabel
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
Source§impl Display for SecurityLabel
impl Display for SecurityLabel
Source§impl Ord for SecurityLabel
impl Ord for SecurityLabel
Source§fn cmp(&self, other: &SecurityLabel) -> Ordering
fn cmp(&self, other: &SecurityLabel) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SecurityLabel
impl PartialEq for SecurityLabel
Source§fn eq(&self, other: &SecurityLabel) -> bool
fn eq(&self, other: &SecurityLabel) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for SecurityLabel
impl PartialOrd for SecurityLabel
Source§impl Serialize for SecurityLabel
impl Serialize for SecurityLabel
impl Copy for SecurityLabel
impl Eq for SecurityLabel
impl StructuralPartialEq for SecurityLabel
Auto Trait Implementations§
impl Freeze for SecurityLabel
impl RefUnwindSafe for SecurityLabel
impl Send for SecurityLabel
impl Sync for SecurityLabel
impl Unpin for SecurityLabel
impl UnsafeUnpin for SecurityLabel
impl UnwindSafe for SecurityLabel
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<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
Checks if this value is equivalent to the given key. Read more
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.