Enum iroh_docs::sync::Capability
source · pub enum Capability {
Write(NamespaceSecret),
Read(NamespaceId),
}
Expand description
The capability of the namespace.
Variants§
Write(NamespaceSecret)
Write access to the namespace.
Read(NamespaceId)
Read only access to the namespace.
Implementations§
source§impl Capability
impl Capability
sourcepub fn id(&self) -> NamespaceId
pub fn id(&self) -> NamespaceId
Get the NamespaceId
for this Capability
.
sourcepub fn secret_key(&self) -> Result<&NamespaceSecret, ReadOnly>
pub fn secret_key(&self) -> Result<&NamespaceSecret, ReadOnly>
Get the NamespaceSecret
of this Capability
.
Will fail if the Capability
is read only.
sourcepub fn kind(&self) -> CapabilityKind
pub fn kind(&self) -> CapabilityKind
Get the kind of capability.
sourcepub fn from_raw(kind: u8, bytes: &[u8; 32]) -> Result<Self>
pub fn from_raw(kind: u8, bytes: &[u8; 32]) -> Result<Self>
Create a Capability
from its raw representation.
sourcepub fn merge(&mut self, other: Capability) -> Result<bool, CapabilityError>
pub fn merge(&mut self, other: Capability) -> Result<bool, CapabilityError>
Merge this capability with another capability.
Will return an error if other
is not a capability for the same namespace.
Returns true
if the capability was changed, false
otherwise.
Trait Implementations§
source§impl Clone for Capability
impl Clone for Capability
source§fn clone(&self) -> Capability
fn clone(&self) -> Capability
Returns a copy 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 Capability
impl Debug for Capability
source§impl<'de> Deserialize<'de> for Capability
impl<'de> Deserialize<'de> for Capability
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<NamespaceId> for Capability
impl From<NamespaceId> for Capability
source§fn from(value: NamespaceId) -> Self
fn from(value: NamespaceId) -> Self
Converts to this type from the input type.
source§impl From<NamespaceSecret> for Capability
impl From<NamespaceSecret> for Capability
source§fn from(value: NamespaceSecret) -> Self
fn from(value: NamespaceSecret) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Capability
impl RefUnwindSafe for Capability
impl Send for Capability
impl Sync for Capability
impl Unpin for Capability
impl UnwindSafe for Capability
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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