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>) -> Self
pub fn name(name: impl Into<ResourceName>) -> Self
Constructs a ResourceRef::Name from anything convertible into a
ResourceName.
Trait Implementations§
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<&Uuid> for ResourceRef
impl From<&Uuid> for ResourceRef
Source§impl From<ResourceName> for ResourceRef
impl From<ResourceName> for ResourceRef
Source§fn from(val: ResourceName) -> Self
fn from(val: ResourceName) -> Self
Converts to this type from the input type.
Source§impl From<Uuid> for ResourceRef
impl From<Uuid> for ResourceRef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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