Skip to main content

PolicyId

Trait PolicyId 

Source
pub trait PolicyId:
    Copy
    + Clone
    + Debug
    + Eq
    + Hash
    + Ord
    + PartialOrd {
    // Required methods
    fn as_u32(&self) -> u32;
    fn from_u32(value: u32) -> Option<Self>;
}
Expand description

Trait for strongly-typed policy identifiers.

Types implementing PolicyId can be parsed from and serialized to u32 values in the binary policy database, but are represented as strongly-typed integers (often wrapping NonZeroU16 or NonZeroU32) in the logical domain model.

Required Methods§

Source

fn as_u32(&self) -> u32

Returns the raw u32 value of the ID.

Source

fn from_u32(value: u32) -> Option<Self>

Constructs an instance of Self from a raw u32 value, returning None if the value is invalid (e.g. zero for a non-optional ID, or out of range).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§