Struct SharedPermissions
pub struct SharedPermissions(/* private fields */);Expand description
The permissions a host shares with what it hosts (an app, its components,
a worker) and changes while they run: a role changed by the record’s
owner, a grant revoked, a workspace’s participation. Every change goes through
Self::set, which moves shared_revision on, so whatever derives
something from shared permissions (which controls may run) derives it
again only after a change, not on every frame.
Implementations§
pub fn new(context: PermissionContext) -> SharedPermissions
pub fn new(context: PermissionContext) -> SharedPermissions
Share context.
pub fn borrow(&self) -> Ref<'_, PermissionContext>
pub fn borrow(&self) -> Ref<'_, PermissionContext>
pub fn try_borrow(&self) -> Result<Ref<'_, PermissionContext>, BorrowError>
pub fn try_borrow(&self) -> Result<Ref<'_, PermissionContext>, BorrowError>
Self::borrow, or an error while a change of them runs.
§Errors
While a Self::set or Self::update of the same permissions runs.
pub fn update<R>(&self, change: impl FnOnce(&mut PermissionContext) -> R) -> R
pub fn update<R>(&self, change: impl FnOnce(&mut PermissionContext) -> R) -> R
Change the permissions in force in place (a one-use grant spent).
pub fn get(&self) -> PermissionContext
pub fn get(&self) -> PermissionContext
The permissions in force now.
pub fn set(&self, context: PermissionContext)
pub fn set(&self, context: PermissionContext)
Put context in force for everyone sharing these permissions.
pub fn ptr_eq(&self, other: &SharedPermissions) -> bool
pub fn ptr_eq(&self, other: &SharedPermissions) -> bool
Whether self and other are the same shared permissions.
pub fn downgrade(&self) -> WeakPermissions
pub fn downgrade(&self) -> WeakPermissions
A handle that does not keep the permissions shared.
Trait Implementations§
§fn clone(&self) -> SharedPermissions
fn clone(&self) -> SharedPermissions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§fn from(context: PermissionContext) -> SharedPermissions
fn from(context: PermissionContext) -> SharedPermissions
Auto Trait Implementations§
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more