pub enum TokenScope {
File {
file_id: String,
access: AccessLevel,
},
}Expand description
Token scope for scoped access tokens (e.g., share links)
Format in JWT: “file:{file_id}:{R|W}” This enum provides type-safe parsing instead of manual string splitting.
Variants§
Implementations§
Source§impl TokenScope
impl TokenScope
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a scope string into a typed TokenScope
Supported formats:
- “file:{file_id}:R” -> File scope with Read access
- “file:{file_id}:W” -> File scope with Write access
Sourcepub fn file_access(&self) -> Option<AccessLevel>
pub fn file_access(&self) -> Option<AccessLevel>
Get access level if this is a file scope
Sourcepub fn matches_file(&self, target_file_id: &str) -> bool
pub fn matches_file(&self, target_file_id: &str) -> bool
Check if scope matches a specific file
Trait Implementations§
Source§impl Clone for TokenScope
impl Clone for TokenScope
Source§fn clone(&self) -> TokenScope
fn clone(&self) -> TokenScope
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenScope
impl Debug for TokenScope
Source§impl PartialEq for TokenScope
impl PartialEq for TokenScope
impl Eq for TokenScope
impl StructuralPartialEq for TokenScope
Auto Trait Implementations§
impl Freeze for TokenScope
impl RefUnwindSafe for TokenScope
impl Send for TokenScope
impl Sync for TokenScope
impl Unpin for TokenScope
impl UnsafeUnpin for TokenScope
impl UnwindSafe for TokenScope
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
Mutably borrows from an owned value. Read more