Enum flux_middle::MaybeExternId
source · pub enum MaybeExternId<Id = LocalDefId> {
Local(Id),
Extern(Id, DefId),
}
Expand description
This enum serves as a type-level reminder that a local definition may be a wrapper for an extern spec. This abstraction is not infallible, so one should be careful and decide in each situation whether to use the local id or the resolved id.
The construction of MaybeExternId
is not encapsulated, but it is recommended to use
GlobalEnv::maybe_extern_id
to create one.
The enum is generic on the local Id
as we use it with various kinds of local ids, e.g.,
LocalDefId
, [OwnerId
], …
Variants§
Local(Id)
An id for a local spec.
Extern(Id, DefId)
A “dummy” local definition wrapping an external spec. The Id
is the local id of the definition
corresponding to the extern spec. The DefId
is the resolved id for the external definition.
Implementations§
Trait Implementations§
source§impl<Id: Clone> Clone for MaybeExternId<Id>
impl<Id: Clone> Clone for MaybeExternId<Id>
source§fn clone(&self) -> MaybeExternId<Id>
fn clone(&self) -> MaybeExternId<Id>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Id: Debug> Debug for MaybeExternId<Id>
impl<Id: Debug> Debug for MaybeExternId<Id>
source§impl IntoQueryParam<DefId> for MaybeExternId
impl IntoQueryParam<DefId> for MaybeExternId
fn into_query_param(self) -> DefId
impl<Id: Copy> Copy for MaybeExternId<Id>
Auto Trait Implementations§
impl<Id> Freeze for MaybeExternId<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for MaybeExternId<Id>where
Id: RefUnwindSafe,
impl<Id> Send for MaybeExternId<Id>where
Id: Send,
impl<Id> Sync for MaybeExternId<Id>where
Id: Sync,
impl<Id> Unpin for MaybeExternId<Id>where
Id: Unpin,
impl<Id> UnwindSafe for MaybeExternId<Id>where
Id: UnwindSafe,
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