pub enum TypeRef {
Show 13 variants
Never,
Placeholder,
Tuple(Vec<TypeRef, Global>),
Path(Path),
RawPtr(Box<TypeRef, Global>, Mutability),
Reference(Box<TypeRef, Global>, Option<LifetimeRef>, Mutability),
Array(Box<TypeRef, Global>, ConstScalar),
Slice(Box<TypeRef, Global>),
Fn(Vec<TypeRef, Global>, bool),
ImplTrait(Vec<Interned<TypeBound>, Global>),
DynTrait(Vec<Interned<TypeBound>, Global>),
Macro(InFile<FileAstId<MacroCall>>),
Error,
}Expand description
Compare ty::Ty
Note: Most users of TypeRef that end up in the salsa database intern it using
Interned<TypeRef> to save space. But notably, nested TypeRefs are not interned, since that
does not seem to save any noticeable amount of memory.
Variants
Never
Placeholder
Tuple(Vec<TypeRef, Global>)
Path(Path)
RawPtr(Box<TypeRef, Global>, Mutability)
Reference(Box<TypeRef, Global>, Option<LifetimeRef>, Mutability)
Array(Box<TypeRef, Global>, ConstScalar)
Slice(Box<TypeRef, Global>)
Fn(Vec<TypeRef, Global>, bool)
A fn pointer. Last element of the vector is the return type.
ImplTrait(Vec<Interned<TypeBound>, Global>)
DynTrait(Vec<Interned<TypeBound>, Global>)
Macro(InFile<FileAstId<MacroCall>>)
Error
Implementations
Trait Implementations
fn into_displayable(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>
fn into_displayable(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>
Returns a Displayable type that is human-readable.
Returns a Displayable type that is human-readable.
Use this for showing types to the user (e.g. diagnostics) Read more
fn display_truncated(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>
fn display_truncated(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>
Returns a Displayable type that is human-readable and tries to be succinct.
Use this for showing types to the user where space is constrained (e.g. doc popups) Read more
fn display_source_code(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> Result<String, DisplaySourceCodeError>
fn display_source_code(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> Result<String, DisplaySourceCodeError>
Returns a String representation of self that can be inserted into the given module.
Use this when generating code (e.g. assists) Read more
Returns a String representation of self for test purposes
Auto Trait Implementations
impl RefUnwindSafe for TypeRef
impl UnwindSafe for TypeRef
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U using CastTo.
Compare self to key and return true if they are equal.
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more