pub struct CapabilityHandle(pub Arc<CapabilityCache>);Expand description
Arc wrapper so CapabilityCache can be registered as Tauri managed state.
Tuple Fields§
§0: Arc<CapabilityCache>Implementations§
Source§impl CapabilityHandle
impl CapabilityHandle
pub fn inner(&self) -> &CapabilityCache
Methods from Deref<Target = CapabilityCache>§
Sourcepub fn record_capability(
&self,
profile: &ProfileId,
bucket: Option<&BucketId>,
op: &str,
class: CapabilityClass,
)
pub fn record_capability( &self, profile: &ProfileId, bucket: Option<&BucketId>, op: &str, class: CapabilityClass, )
Insert or update a capability record for the given (profile, bucket, op) triple.
bucket is None for profile-level operations (e.g. ListBuckets).
Sourcepub fn record_from_error(
&self,
profile: &ProfileId,
bucket: Option<&BucketId>,
op: &str,
error: &AppError,
) -> Result<bool, AppError>
pub fn record_from_error( &self, profile: &ProfileId, bucket: Option<&BucketId>, op: &str, error: &AppError, ) -> Result<bool, AppError>
Classify error and, if classifiable, record the result for the given
(profile, bucket, op) triple.
Returns Ok(true) when the error was classified and stored.
Returns Ok(false) when the error is not classifiable (no record is
stored).
Sourcepub fn get(
&self,
profile: &ProfileId,
bucket: Option<&BucketId>,
op: &str,
) -> Option<CapabilityRecord>
pub fn get( &self, profile: &ProfileId, bucket: Option<&BucketId>, op: &str, ) -> Option<CapabilityRecord>
Look up a capability record. Returns None if missing or expired.
Sourcepub fn get_map(&self, profile: &ProfileId) -> CapabilityMap
pub fn get_map(&self, profile: &ProfileId) -> CapabilityMap
Return all non-expired capability records for profile as a flat map.
Key format: "<bucket>/<op>" where <bucket> is empty for
profile-level operations.
Sourcepub fn clear(&self, profile: &ProfileId, scope: &ClearScope)
pub fn clear(&self, profile: &ProfileId, scope: &ClearScope)
Remove entries for profile that match scope.
After clear(All) the profile has zero entries in the cache. After
clear(Bucket(id)) only that bucket’s entries are removed (other
buckets and profile-level ops remain). After clear(Op(name)) only
entries with that exact operation string are removed.
Trait Implementations§
Source§impl Clone for CapabilityHandle
impl Clone for CapabilityHandle
Source§fn clone(&self) -> CapabilityHandle
fn clone(&self) -> CapabilityHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for CapabilityHandle
impl Default for CapabilityHandle
Source§fn default() -> CapabilityHandle
fn default() -> CapabilityHandle
Source§impl Deref for CapabilityHandle
impl Deref for CapabilityHandle
Source§type Target = CapabilityCache
type Target = CapabilityCache
Source§fn deref(&self) -> &CapabilityCache
fn deref(&self) -> &CapabilityCache
Auto Trait Implementations§
impl Freeze for CapabilityHandle
impl !RefUnwindSafe for CapabilityHandle
impl Send for CapabilityHandle
impl Sync for CapabilityHandle
impl Unpin for CapabilityHandle
impl UnsafeUnpin for CapabilityHandle
impl !UnwindSafe for CapabilityHandle
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> 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