Skip to main content

Capability

Struct Capability 

Source
pub struct Capability {
    pub id: CapabilityId,
    pub name: String,
    pub schubert_class: SchubertClass,
    pub requires: Vec<CapabilityId>,
    pub conflicts: Vec<CapabilityId>,
}
Expand description

A capability in ShaperOS: an incidence condition on namespaces

Capabilities represent access rights that can be granted to namespaces. Each capability corresponds to a Schubert class, representing the geometric condition that a namespace must satisfy to have that capability.

§Contracts

  • The Schubert class must be valid for the given Grassmannian
  • Dependencies form a DAG (no cycles)
  • Conflicts are symmetric (if A conflicts with B, B should conflict with A)

Fields§

§id: CapabilityId

Unique identifier

§name: String

Human-readable name

§schubert_class: SchubertClass

Schubert class representing the incidence condition “Namespaces with this capability” = Schubert variety σ_λ

§requires: Vec<CapabilityId>

Dependencies: must have these capabilities first

§conflicts: Vec<CapabilityId>

Conflicts: cannot coexist with these

Implementations§

Source§

impl Capability

Source

pub fn new( id: impl Into<String>, name: impl Into<String>, partition: Vec<usize>, grassmannian: (usize, usize), ) -> EnumerativeResult<Self>

Create a new capability

§Contract
requires: partition fits in Grassmannian box
ensures: result.codimension() == partition.iter().sum()
Source

pub fn requires(self, cap_id: CapabilityId) -> Self

Add a dependency (builder pattern)

Source

pub fn requires_all( self, cap_ids: impl IntoIterator<Item = CapabilityId>, ) -> Self

Add multiple dependencies

Source

pub fn conflicts_with(self, cap_id: CapabilityId) -> Self

Add a conflict (builder pattern)

Source

pub fn conflicts_with_all( self, cap_ids: impl IntoIterator<Item = CapabilityId>, ) -> Self

Add multiple conflicts

Source

pub fn codimension(&self) -> usize

Codimension of this capability’s Schubert class

§Contract
ensures: result == self.schubert_class.codimension()
Source

pub fn has_dependencies(&self) -> bool

Check if this capability has any dependencies

Source

pub fn has_conflicts(&self) -> bool

Check if this capability has any conflicts

Trait Implementations§

Source§

impl Clone for Capability

Source§

fn clone(&self) -> Capability

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Capability

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.