pub enum Ref<T> {
Resolved(Id<T>),
Pending(PendingRef),
Broken(BreakCause),
}Expand description
A reference from one node to another.
Deliberately not Option<Id<T>>: type discovery delivers types whose
targets have not arrived yet, and “absent” and “not resolved yet” are
different facts that both need representing. Spec §2.
Variants§
Resolved(Id<T>)
Points at a live node.
Pending(PendingRef)
Names a target that has not been resolved yet.
Broken(BreakCause)
Resolution was attempted and failed.
Implementations§
Source§impl<T> Ref<T>
impl<T> Ref<T>
Sourcepub const fn is_resolved(&self) -> bool
pub const fn is_resolved(&self) -> bool
Whether this reference points at a live node.
Sourcepub const fn is_pending(&self) -> bool
pub const fn is_pending(&self) -> bool
Whether resolution is still outstanding.
Sourcepub const fn pending_key(&self) -> Option<&PendingRef>
pub const fn pending_key(&self) -> Option<&PendingRef>
The lookup key, for the pending-reference index.
None once the reference is resolved or broken. A broken
reference is not waiting on anything and must not be retried
implicitly — a diagnostic already reported must not silently
vanish. Spec §2.
Sourcepub const fn break_cause(&self) -> Option<&BreakCause>
pub const fn break_cause(&self) -> Option<&BreakCause>
The failure cause, if broken.
Trait Implementations§
impl<T: Eq> Eq for Ref<T>
impl<T: PartialEq> StructuralPartialEq for Ref<T>
Auto Trait Implementations§
impl<T> Freeze for Ref<T>
impl<T> RefUnwindSafe for Ref<T>where
Id<T>: RefUnwindSafe,
impl<T> Send for Ref<T>
impl<T> Sync for Ref<T>
impl<T> Unpin for Ref<T>
impl<T> UnsafeUnpin for Ref<T>where
Id<T>: UnsafeUnpin,
impl<T> UnwindSafe for Ref<T>where
Id<T>: 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