Skip to main content

GrantSeat

Struct GrantSeat 

Source
pub struct GrantSeat { /* private fields */ }
Expand description

A host-only capability-grant seat: the authority to grant a capability into a Cx.

A GrantSeat is minted ONLY when a context is constructed (Cx::new_seated) or, under the test-support feature, by GrantSeat::for_test. It has no public constructor otherwise, so it cannot be forged. Crucially, it is never passed into Callable::call – a loaded callable receives a &mut Cx but no seat, so it cannot grant itself a capability. Host code (a bootloader, a server session, a loader) holds the seat and grants through it.

Implementations§

Source§

impl GrantSeat

Source

pub fn grant(&self, cx: &mut Cx, capability: CapabilityName)

Grants a capability into cx under this host authority.

A seat may only grant into the context it was minted with (Cx::new_seated). Minting a fresh (Cx, GrantSeat) pair yields a seat bound to the fresh context, so it cannot be used to escalate a different (e.g. the caller’s own) context – this is what keeps a loaded callable from granting itself a capability.

Source

pub fn grant_named(&self, cx: &mut Cx, capability: &'static str)

Grants a capability named by a static string into cx.

Trait Implementations§

Source§

impl Debug for GrantSeat

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> 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, 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.