pub struct ItemRef {
pub(crate) contents: Node<ItemRefContents>,
}
Expand description
Reference to an item, with generics. Basically any mention of an item (function, type, etc) uses this.
This can refer to a top-level item or to a trait associated item. Example:
ⓘ
trait MyTrait<TraitType, const TraitConst: usize> {
fn meth<MethType>(...) {...}
}
fn example_call<TraitType, SelfType: MyTrait<TraitType, 12>>(x: SelfType) {
x.meth::<String>(...)
}
Here, in the call x.meth::<String>(...)
we will build an ItemRef
that looks like:
ⓘ
ItemRef {
def_id = MyTrait::meth,
generic_args = [String],
impl_exprs = [<proof of `String: Sized`>],
in_trait = Some(<proof of `SelfType: MyTrait<TraitType, 12>`>,
}
The in_trait
ImplExpr
will have in its trait
field a representation of the SelfType: MyTrait<TraitType, 12>
predicate, which looks like:
ⓘ
ItemRef {
def_id = MyTrait,
generic_args = [SelfType, TraitType, 12],
impl_exprs = [],
in_trait = None,
}
Fields§
§contents: Node<ItemRefContents>
Implementations§
Source§impl ItemRef
impl ItemRef
pub fn new<'tcx, S: BaseState<'tcx>>( s: &S, def_id: DefId, generic_args: Vec<GenericArg>, impl_exprs: Vec<ImplExpr>, in_trait: Option<ImplExpr>, ) -> ItemRef
pub fn contents(&self) -> &ItemRefContents
pub fn mutate<'tcx, S: BaseState<'tcx>>( &mut self, s: &S, f: impl FnOnce(&mut ItemRefContents), )
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ItemRef
impl<'de> Deserialize<'de> for ItemRef
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 ItemRef
impl JsonSchema for ItemRef
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§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§impl Ord for ItemRef
impl Ord for ItemRef
Source§impl PartialOrd for ItemRef
impl PartialOrd for ItemRef
impl Eq for ItemRef
impl StructuralPartialEq for ItemRef
Auto Trait Implementations§
impl Freeze for ItemRef
impl RefUnwindSafe for ItemRef
impl Send for ItemRef
impl Sync for ItemRef
impl Unpin for ItemRef
impl UnwindSafe for ItemRef
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