pub struct TypeParam { /* private fields */ }Implementations§
Source§impl TypeParam
impl TypeParam
pub fn merge(self) -> TypeOrConstParam
pub fn name(self, db: &dyn HirDatabase) -> Name
pub fn parent(self, _db: &dyn HirDatabase) -> GenericDef
pub fn module(self, db: &dyn HirDatabase) -> Module
Sourcepub fn is_implicit(self, db: &dyn HirDatabase) -> bool
pub fn is_implicit(self, db: &dyn HirDatabase) -> bool
Is this type parameter implicitly introduced (eg. Self in a trait or an impl Trait
argument)?
pub fn ty(self, db: &dyn HirDatabase) -> Type<'_>
Sourcepub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait>
pub fn trait_bounds(self, db: &dyn HirDatabase) -> Vec<Trait>
FIXME: this only lists trait bounds from the item defining the type parameter, not additional bounds that might be added e.g. by a method if the parameter comes from an impl!
pub fn default(self, db: &dyn HirDatabase) -> Option<Type<'_>>
pub fn is_unstable(self, db: &dyn HirDatabase) -> bool
Trait Implementations§
Source§impl From<TypeParam> for GenericParam
impl From<TypeParam> for GenericParam
Source§fn from(it: TypeParam) -> GenericParam
fn from(it: TypeParam) -> GenericParam
Converts to this type from the input type.
Source§impl HasAttrs for TypeParam
impl HasAttrs for TypeParam
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner
fn hir_docs(self, db: &dyn HirDatabase) -> Option<&Docs>
Source§impl<'db> HirDisplay<'db> for TypeParam
impl<'db> HirDisplay<'db> for TypeParam
fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result
§fn into_displayable<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
max_size: Option<usize>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
display_kind: DisplayKind,
closure_style: ClosureStyle,
show_container_bounds: bool,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
fn into_displayable<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
max_size: Option<usize>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
display_kind: DisplayKind,
closure_style: ClosureStyle,
show_container_bounds: bool,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
Returns a
Displayable type that is human-readable.§fn display<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
fn display<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
Returns a
Displayable type that is human-readable.
Use this for showing types to the user (e.g. diagnostics)§fn display_truncated<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
max_size: Option<usize>,
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
fn display_truncated<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
max_size: Option<usize>,
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, 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)§fn display_limited<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
limited_size: Option<usize>,
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
fn display_limited<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
limited_size: Option<usize>,
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
Returns a
Displayable type that is human-readable and tries to limit the number of items inside.
Use this for showing definitions which may contain too many items, like trait, struct, enum§fn display_source_code<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
module_id: ModuleIdLt<'static>,
allow_opaque: bool,
) -> Result<String, DisplaySourceCodeError>
fn display_source_code<'a>( &'a self, db: &'db (dyn HirDatabase + 'static), module_id: ModuleIdLt<'static>, 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)§fn display_test<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
fn display_test<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
Returns a String representation of
self for test purposes§fn display_with_container_bounds<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
show_container_bounds: bool,
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
fn display_with_container_bounds<'a>(
&'a self,
db: &'db (dyn HirDatabase + 'static),
show_container_bounds: bool,
display_target: DisplayTarget,
) -> HirDisplayWrapper<'a, 'db, Self>where
Self: Sized,
Returns a String representation of
self that shows the constraint from
the container for functionsimpl Copy for TypeParam
impl Eq for TypeParam
impl StructuralPartialEq for TypeParam
Auto Trait Implementations§
impl Freeze for TypeParam
impl RefUnwindSafe for TypeParam
impl Send for TypeParam
impl Sync for TypeParam
impl Unpin for TypeParam
impl UnwindSafe for TypeParam
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,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> 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.§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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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