pub struct DefId {
pub(crate) contents: Node<DefIdContents>,
}
Expand description
Reflects rustc_hir::def_id::DefId
, augmented to also give ids to promoted constants (which
have their own ad-hoc numbering scheme in rustc for now).
Fields§
§contents: Node<DefIdContents>
Implementations§
Source§impl DefId
impl DefId
Sourcepub fn as_rust_def_id(&self) -> Option<RDefId>
pub fn as_rust_def_id(&self) -> Option<RDefId>
The rustc def_id corresponding to this item, if there is one. Promoted constants don’t have a rustc def_id.
Sourcepub fn underlying_rust_def_id(&self) -> RDefId
pub fn underlying_rust_def_id(&self) -> RDefId
The def_id of this item or its parent if this is a promoted constant.
pub fn promoted_id(&self) -> Option<PromotedId>
Sourcepub fn ancestry(&self) -> impl Iterator<Item = &Self>
pub fn ancestry(&self) -> impl Iterator<Item = &Self>
Iterate over this element and its parents.
Sourcepub fn path_item(&self) -> DisambiguatedDefPathItem
pub fn path_item(&self) -> DisambiguatedDefPathItem
The PathItem
corresponding to this item.
Sourcepub fn make_promoted_child<'tcx, S: BaseState<'tcx>>(
&self,
s: &S,
promoted_id: PromotedId,
) -> Self
pub fn make_promoted_child<'tcx, S: BaseState<'tcx>>( &self, s: &S, promoted_id: PromotedId, ) -> Self
Construct a hax DefId
for the nth promoted constant of the current item. That DefId
has
no corresponding rustc DefId
.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DefId
impl<'de> Deserialize<'de> for DefId
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 JsonSchema for DefId
impl JsonSchema for DefId
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreSource§impl Ord for DefId
impl Ord for DefId
Source§impl PartialOrd for DefId
impl PartialOrd for DefId
Source§impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, DefId> for LocalDefId
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, DefId> for LocalDefId
impl Eq for DefId
impl StructuralPartialEq for DefId
Auto Trait Implementations§
impl Freeze for DefId
impl RefUnwindSafe for DefId
impl Send for DefId
impl Sync for DefId
impl Unpin for DefId
impl UnwindSafe for DefId
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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