pub enum TypeRef {
Show 13 variants
Never,
Placeholder,
Tuple(Vec<TypeRef>),
Path(Path),
RawPtr(Box<TypeRef>, Mutability),
Reference(Box<TypeRef>, Option<LifetimeRef>, Mutability),
Array(Box<TypeRef>, ConstRef),
Slice(Box<TypeRef>),
Fn(Vec<(Option<Name>, TypeRef)>, bool, bool, Option<Interned<str>>),
ImplTrait(Vec<Interned<TypeBound>>),
DynTrait(Vec<Interned<TypeBound>>),
Macro(InFileWrapper<HirFileId, 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>)
Path(Path)
RawPtr(Box<TypeRef>, Mutability)
Reference(Box<TypeRef>, Option<LifetimeRef>, Mutability)
Array(Box<TypeRef>, ConstRef)
Slice(Box<TypeRef>)
Fn(Vec<(Option<Name>, TypeRef)>, bool, bool, Option<Interned<str>>)
A fn pointer. Last element of the vector is the return type.
ImplTrait(Vec<Interned<TypeBound>>)
DynTrait(Vec<Interned<TypeBound>>)
Macro(InFileWrapper<HirFileId, FileAstId<MacroCall>>)
Error
Implementations§
Trait Implementations§
source§impl HirDisplay for TypeRef
impl HirDisplay for TypeRef
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>
source§fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Displayable type that is human-readable.source§fn display<'a>(&'a self, db: &'a dyn HirDatabase) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display<'a>(&'a self, db: &'a dyn HirDatabase) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Displayable type that is human-readable.
Use this for showing types to the user (e.g. diagnostics)source§fn display_truncated<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_truncated<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
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)source§fn display_source_code<'a>(
&'a self,
db: &'a dyn HirDatabase,
module_id: ModuleId,
allow_opaque: bool
) -> Result<String, DisplaySourceCodeError>
fn display_source_code<'a>( &'a self, db: &'a dyn HirDatabase, module_id: ModuleId, allow_opaque: bool ) -> 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)source§fn display_test<'a>(
&'a self,
db: &'a dyn HirDatabase
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_test<'a>(
&'a self,
db: &'a dyn HirDatabase
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a String representation of
self for test purposessource§impl PartialEq for TypeRef
impl PartialEq for TypeRef
impl Eq for TypeRef
impl StructuralPartialEq for TypeRef
Auto Trait Implementations§
impl RefUnwindSafe for TypeRef
impl Send for TypeRef
impl Sync for TypeRef
impl Unpin for TypeRef
impl UnwindSafe for TypeRef
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
§impl<T> Cast for T
impl<T> Cast for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.