Skip to main content

FluxId

Struct FluxId 

Source
pub struct FluxId<Id> {
    parent: Id,
    name: Symbol,
}
Expand description

An id for a Flux-specific item that doesn’t have a corresponding Rust item and thus, we cannot identify it with a [DefId]. This includes, for example, associated refinements, qualifiers and refinement functions.

§Type-level invariant

This struct maintains a type-level invariant ensuring that the referenced item exists. The id is composed of two parts:

  • parent: A reference to a parent Rust item
  • name: A name uniquely identifiying the item within the parent

Since the name can be an arbitrary Symbol, this doesn’t guarantee the existence of the item, so we must be careful when creating instances of this struct.

§Implementation Details

  • Fields are private to ensure construction only through FluxId::new
  • A clippy lint prevents direct usage of FluxId::new, which can be selectively disabled when item existence is guaranteed
  • The type is parametric over the parent Id type to support various id types (e.g., [DefId], MaybeExternId)

Fields§

§parent: Id§name: Symbol

Implementations§

Source§

impl<Id> FluxId<Id>

Source

pub fn new(parent: Id, name: Symbol) -> Self

Source

pub fn parent(self) -> Id

Source

pub fn name(self) -> Symbol

Source§

impl FluxId<DefId>

Source

pub fn as_local(self) -> Option<FluxLocalDefId>

Source

pub fn expect_local(self) -> FluxLocalDefId

Source

pub fn krate(self) -> CrateNum

Source

pub fn index(self) -> FluxId<DefIndex>

Source§

impl FluxId<LocalDefId>

Source

pub fn to_def_id(self) -> FluxDefId

Source

pub fn local_def_index(self) -> FluxId<DefIndex>

Source§

impl FluxId<MaybeExternId>

Trait Implementations§

Source§

impl<Id: Clone> Clone for FluxId<Id>

Source§

fn clone(&self) -> FluxId<Id>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Id: Copy> Copy for FluxId<Id>

Source§

impl<Id: Debug> Debug for FluxId<Id>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Id, __D: SpanDecoder> Decodable<__D> for FluxId<Id>
where Id: Decodable<__D>,

Source§

fn decode(__decoder: &mut __D) -> Self

Source§

impl<Id, __E: SpanEncoder> Encodable<__E> for FluxId<Id>
where Id: Encodable<__E>,

Source§

fn encode(&self, __encoder: &mut __E)

Source§

impl<Id: Eq> Eq for FluxId<Id>

Source§

impl<Id: Hash> Hash for FluxId<Id>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoQueryKey<FluxId<DefId>> for FluxLocalDefId

Source§

fn into_query_key(self) -> FluxDefId

Argument conversion from Self to K. This should always be a very cheap conversion, e.g. [LocalDefId::to_def_id].
Source§

impl<Id: PartialEq> PartialEq for FluxId<Id>

Source§

fn eq(&self, other: &FluxId<Id>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<Id: PartialEq> StructuralPartialEq for FluxId<Id>

Auto Trait Implementations§

§

impl<Id> DynSend for FluxId<Id>
where Id: DynSend,

§

impl<Id> DynSync for FluxId<Id>
where Id: DynSync,

§

impl<Id> Freeze for FluxId<Id>
where Id: Freeze,

§

impl<Id> RefUnwindSafe for FluxId<Id>
where Id: RefUnwindSafe,

§

impl<Id> Send for FluxId<Id>
where Id: Send,

§

impl<Id> Sync for FluxId<Id>
where Id: Sync,

§

impl<Id> Unpin for FluxId<Id>
where Id: Unpin,

§

impl<Id> UnsafeUnpin for FluxId<Id>
where Id: UnsafeUnpin,

§

impl<Id> UnwindSafe for FluxId<Id>
where Id: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<K> IntoQueryKey<K> for K

§

fn into_query_key(self) -> K

Argument conversion from Self to K. This should always be a very cheap conversion, e.g. [LocalDefId::to_def_id].
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more