pub enum ResourceRef {
Uuid(Uuid),
Name(ResourceName),
Undefined,
}Expand description
A reference to a resource, by id, by name, or unspecified.
A resource can be addressed two ways: by its stable Uuid or by its
human-readable ResourceName. Undefined is a third state for when no
particular resource is meant (a wildcard), used chiefly in policy checks.
Variants§
Uuid(Uuid)
References a resource by its stable unique identifier.
Name(ResourceName)
References a resource by its hierarchical ResourceName.
Undefined
Not referencing a specific resource.
This is used to represent a wildcard in a policy which can be useful to check if a user can create or manage resources at a specific level.
Implementations§
Source§impl ResourceRef
impl ResourceRef
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Returns true if this reference is ResourceRef::Undefined (a wildcard).
Sourcepub fn name(name: impl Into<ResourceName>) -> ResourceRef
pub fn name(name: impl Into<ResourceName>) -> ResourceRef
Constructs a ResourceRef::Name from anything convertible into a
ResourceName.
Trait Implementations§
Source§impl AsRef<ResourceRef> for ResourceIdent
impl AsRef<ResourceRef> for ResourceIdent
Source§fn as_ref(&self) -> &ResourceRef
fn as_ref(&self) -> &ResourceRef
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for ResourceRef
impl Clone for ResourceRef
Source§fn clone(&self) -> ResourceRef
fn clone(&self) -> ResourceRef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ResourceRef
impl Debug for ResourceRef
Source§impl Display for ResourceRef
impl Display for ResourceRef
impl Eq for ResourceRef
Source§impl From<&ResourceIdent> for ResourceRef
impl From<&ResourceIdent> for ResourceRef
Source§fn from(ident: &ResourceIdent) -> Self
fn from(ident: &ResourceIdent) -> Self
Converts to this type from the input type.
Source§impl From<&Uuid> for ResourceRef
impl From<&Uuid> for ResourceRef
Source§fn from(val: &Uuid) -> ResourceRef
fn from(val: &Uuid) -> ResourceRef
Converts to this type from the input type.
Source§impl From<ResourceIdent> for ResourceRef
impl From<ResourceIdent> for ResourceRef
Source§fn from(ident: ResourceIdent) -> Self
fn from(ident: ResourceIdent) -> Self
Converts to this type from the input type.
Source§impl From<ResourceName> for ResourceRef
impl From<ResourceName> for ResourceRef
Source§fn from(val: ResourceName) -> ResourceRef
fn from(val: ResourceName) -> ResourceRef
Converts to this type from the input type.
Source§impl From<Uuid> for ResourceRef
impl From<Uuid> for ResourceRef
Source§fn from(val: Uuid) -> ResourceRef
fn from(val: Uuid) -> ResourceRef
Converts to this type from the input type.
Source§impl Hash for ResourceRef
impl Hash for ResourceRef
Source§impl PartialEq for ResourceRef
impl PartialEq for ResourceRef
impl StructuralPartialEq for ResourceRef
Auto Trait Implementations§
impl Freeze for ResourceRef
impl RefUnwindSafe for ResourceRef
impl Send for ResourceRef
impl Sync for ResourceRef
impl Unpin for ResourceRef
impl UnsafeUnpin for ResourceRef
impl UnwindSafe for ResourceRef
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