Struct cedar_policy_core::ast::Name
source · pub struct Name { /* private fields */ }
Expand description
This is the Name
type used to name types, functions, etc.
The name can include namespaces.
Clone is O(1).
Implementations§
source§impl Name
impl Name
sourcepub fn new(basename: Id, path: impl IntoIterator<Item = Id>) -> Self
pub fn new(basename: Id, path: impl IntoIterator<Item = Id>) -> Self
A full constructor for Name
sourcepub fn unqualified_name(id: Id) -> Self
pub fn unqualified_name(id: Id) -> Self
Create a Name
with no path (no namespaces).
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 type_in_namespace(basename: Id, namespace: Name) -> Name
pub fn type_in_namespace(basename: Id, namespace: Name) -> Name
Given a type basename and a namespace (as a Name
itself),
return a Name
representing the type’s fully qualified name
sourcepub fn namespace_components(&self) -> impl Iterator<Item = &Id>
pub fn namespace_components(&self) -> impl Iterator<Item = &Id>
Get the namespace of the Name
, as components
Trait Implementations§
source§impl<'de> Deserialize<'de> for Name
impl<'de> Deserialize<'de> for Name
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 FromNormalizedStr for Name
impl FromNormalizedStr for Name
source§fn describe_self() -> &'static str
fn describe_self() -> &'static str
Short string description of the
Self
type, to be used in error messages.
What are we trying to parse?source§fn from_normalized_str(s: &str) -> Result<Self, ParseErrors>
fn from_normalized_str(s: &str) -> Result<Self, ParseErrors>
Create a
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§impl Ord for Name
impl Ord for Name
source§impl PartialOrd for Name
impl PartialOrd for Name
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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