pub struct Name(/* private fields */);Expand description
A new type which indicates that the contained InternalName does not
contain reserved __cedar, as specified by RFC 52.
This represents names which are legal for end-users to define, while
InternalName represents names which are legal for end-users to
reference.
Implementations§
Source§impl Name
impl Name
Sourcepub fn parse_unqualified_name(s: &str) -> Result<Self, ParseErrors>
pub fn parse_unqualified_name(s: &str) -> Result<Self, ParseErrors>
Create a Name with no path (no namespaces).
Returns an error if s is not a valid identifier.
Sourcepub fn unqualified_name(id: UnreservedId) -> Self
pub fn unqualified_name(id: UnreservedId) -> Self
Create a Name with no path (no namespaces).
Sourcepub fn basename_as_ref(&self) -> &Id
pub fn basename_as_ref(&self) -> &Id
Sourcepub fn basename(&self) -> UnreservedId
pub fn basename(&self) -> UnreservedId
Get the basename of the Name (ie, with namespaces stripped).
Return an UnreservedId
Sourcepub fn is_unqualified(&self) -> bool
pub fn is_unqualified(&self) -> bool
Test if a Name is an UnreservedId
Sourcepub fn qualify_with(&self, namespace: Option<&InternalName>) -> InternalName
pub fn qualify_with(&self, namespace: Option<&InternalName>) -> InternalName
Qualify the name with an optional namespace
This method has the same behavior as InternalName::qualify_with()
Sourcepub fn qualify_with_name(&self, namespace: Option<&Self>) -> Self
pub fn qualify_with_name(&self, namespace: Option<&Self>) -> Self
Qualify the name with an optional namespace
This method has the same behavior as InternalName::qualify_with_name() except that
it’s guaranteed to return Name, not InternalName
Trait Implementations§
Source§impl AsRef<InternalName> for Name
impl AsRef<InternalName> for Name
Source§fn as_ref(&self) -> &InternalName
fn as_ref(&self) -> &InternalName
Source§impl AsRef<Name> for EntityType
impl AsRef<Name> for EntityType
Source§impl<'de> Deserialize<'de> for Name
Deserialize a Name using from_normalized_str
This deserialization implementation is used in the JSON schema format.
impl<'de> Deserialize<'de> for Name
Deserialize a Name using from_normalized_str
This deserialization implementation is used in the JSON schema format.
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>,
Source§impl From<EntityType> for Name
impl From<EntityType> for Name
Source§fn from(ty: EntityType) -> Name
fn from(ty: EntityType) -> Name
Source§impl From<Name> for EntityType
impl From<Name> for EntityType
Source§impl From<Name> for InternalName
impl From<Name> for InternalName
Source§impl From<UnreservedId> for Name
impl From<UnreservedId> for Name
Source§fn from(value: UnreservedId) -> Self
fn from(value: UnreservedId) -> Self
Source§impl FromNormalizedStr for Name
impl FromNormalizedStr for Name
Source§fn from_normalized_str(s: &str) -> Result<Self, ParseErrors>
fn from_normalized_str(s: &str) -> Result<Self, ParseErrors>
Self by parsing a string, which is required to be normalized.
That is, the input is required to roundtrip with the Display impl on Self:
Self::from_normalized_str(x).to_string() == x must hold. Read moreSource§fn describe_self() -> &'static str
fn describe_self() -> &'static str
Self type, to be used in error messages.
What are we trying to parse?Source§impl Ord for Name
impl Ord for Name
Source§impl PartialOrd for Name
impl PartialOrd for Name
Source§impl<'a> TryFrom<&'a InternalName> for &'a Name
impl<'a> TryFrom<&'a InternalName> for &'a Name
Source§type Error = ReservedNameError
type Error = ReservedNameError
Source§fn try_from(value: &'a InternalName) -> Result<&'a Name, ReservedNameError>
fn try_from(value: &'a InternalName) -> Result<&'a Name, ReservedNameError>
Source§impl TryFrom<InternalName> for Name
impl TryFrom<InternalName> for Name
Source§type Error = ReservedNameError
type Error = ReservedNameError
Source§impl TryFrom<Name> for UnreservedId
impl TryFrom<Name> for UnreservedId
impl Eq for Name
impl StructuralPartialEq for Name
Auto Trait Implementations§
impl Freeze for Name
impl RefUnwindSafe for Name
impl Send for Name
impl Sync for Name
impl Unpin for Name
impl UnwindSafe for Name
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.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