Struct kernel::storage_permissions::StoragePermissions

source ·
pub struct StoragePermissions { /* private fields */ }
Expand description

List of storage permissions for a storage user.

These identifiers signify what permissions a storage user has. The storage mechanism defines how the identifiers are assigned and how they relate to stored objects.

For simplicity, a we store to eight read and eight write permissions. The first count u32 values in permissions are valid.

Mar, 2022: This interface is considered experimental and for initial prototyping. As we learn more about how these permissions are set and used we may want to revamp this interface.

Implementations§

source§

impl StoragePermissions

source

pub fn new_kernel_permissions(_cap: &dyn KerneluserStorageCapability) -> Self

Create superuser permissions suitable for the kernel. This allows the kernel to read/update any stored item, and allows the kernel to write items that will not be accessible to any clients without superuser permissions.

source

pub fn check_read_permission(&self, storage_id: u32) -> bool

Check if this permission object grants read access to the specified storage_id. Returns true if access is permitted, false otherwise.

source

pub fn check_write_permission(&self, storage_id: u32) -> bool

Check if this permission object grants modify access to the specified storage_id. Returns true if access is permitted, false otherwise.

source

pub fn get_write_id(&self) -> Option<u32>

Get the write_id for saving items to the storage.

Trait Implementations§

source§

impl Clone for StoragePermissions

source§

fn clone(&self) -> StoragePermissions

Returns a copy 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 Copy for StoragePermissions

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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

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

§

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

§

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.