pub struct ConditionalName { /* private fields */ }
Expand description
A name which may refer to many possible different fully-qualified names, depending on which of them are declared (in any schema fragment)
Caution using ==
on these: ConditionalName
s are only equal if the have
the same raw (source) and the same list of possible resolution targets (in
the same order), which in practice means they must be in the same
current/active namespace. In particular:
- two
ConditionalName
s which end up resolving to the same fully-qualified name may nonetheless not be==
in theirConditionalName
forms; and - two
ConditionalName
s which are written the same way in the original schema may nonetheless not be==
in theirConditionalName
forms
This type has only one (trivial) public constructor; it is normally
constructed using RawName::conditionally_qualify_with()
.
Implementations§
Source§impl ConditionalName
impl ConditionalName
Sourcepub fn unconditional(name: InternalName, reference_type: ReferenceType) -> Self
pub fn unconditional(name: InternalName, reference_type: ReferenceType) -> Self
Create a ConditionalName
which unconditionally resolves to the given
fully-qualified InternalName
.
Sourcepub fn raw(&self) -> &RawName
pub fn raw(&self) -> &RawName
Get the (not-yet-necessarily-fully-qualified) RawName
which was
encountered in the source, for the purposes of error messages
Sourcepub fn resolve(
self,
all_defs: &AllDefs,
) -> Result<InternalName, TypeNotDefinedError>
pub fn resolve( self, all_defs: &AllDefs, ) -> Result<InternalName, TypeNotDefinedError>
Resolve the ConditionalName
into a fully-qualified InternalName
,
given that all_defs
includes all fully-qualified InternalName
s
defined in all schema fragments.
Note that this returns InternalName
(as opposed to Name
),
because type references may resolve to an internal name like
__cedar::String
.
In general, as noted on InternalName
, InternalName
s are valid
to appear as type references, and we generally expect
ConditionalName
s to also represent type references.
all_defs
also internally includes InternalName
s, because some
names containing __cedar
might be internally defined/valid, even
though it is not valid for end-users to define those names.
Trait Implementations§
Source§impl Clone for ConditionalName
impl Clone for ConditionalName
Source§fn clone(&self) -> ConditionalName
fn clone(&self) -> ConditionalName
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ConditionalName
impl Debug for ConditionalName
Source§impl Hash for ConditionalName
impl Hash for ConditionalName
Source§impl PartialEq for ConditionalName
impl PartialEq for ConditionalName
Source§impl Serialize for ConditionalName
impl Serialize for ConditionalName
ConditionalName
serializes as simply the raw name that was originally encountered in the schema
impl Eq for ConditionalName
impl StructuralPartialEq for ConditionalName
Auto Trait Implementations§
impl Freeze for ConditionalName
impl RefUnwindSafe for ConditionalName
impl Send for ConditionalName
impl Sync for ConditionalName
impl Unpin for ConditionalName
impl UnwindSafe for ConditionalName
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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