pub struct Ty(_);
Expand description
External representation of a type. This should be cheap to clone.
Implementations§
source§impl Ty
impl Ty
sourcepub fn interned_mut(&mut self) -> &mut TyKind
pub fn interned_mut(&mut self) -> &mut TyKind
Returns a mutable reference of TyKind
for this instance
sourcepub fn into_inner(self) -> TyKind
pub fn into_inner(self) -> TyKind
Convert this instance back to the TyKind
that created it.
source§impl Ty
impl Ty
sourcepub fn as_struct(&self) -> Option<Struct>
pub fn as_struct(&self) -> Option<Struct>
If this type represents a struct type, returns the type of the struct.
sourcepub fn as_tuple(&self) -> Option<&Substitution>
pub fn as_tuple(&self) -> Option<&Substitution>
If this type represents a tuple type, returns a reference to the substitutions of the tuple.
sourcepub fn as_array(&self) -> Option<&Ty>
pub fn as_array(&self) -> Option<&Ty>
If this type represents an array type, returns a reference to the element type.
sourcepub fn as_callable_def(&self) -> Option<CallableDef>
pub fn as_callable_def(&self) -> Option<CallableDef>
Returns the callable definition for the given expression or None
if the type does not
represent a callable.
sourcepub fn callable_sig(&self, db: &dyn HirDatabase) -> Option<FnSig>
pub fn callable_sig(&self, db: &dyn HirDatabase) -> Option<FnSig>
Returns the callable signature of the type, if the type is callable.
sourcepub fn guid_string(&self, db: &dyn HirDatabase) -> Option<String>
pub fn guid_string(&self, db: &dyn HirDatabase) -> Option<String>
Returns the type’s name as a string, if one exists.
This name needs to be unique as it is used to generate a type’s Guid
.
sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this instance is of an unknown type.
sourcepub fn type_parameters(&self) -> Option<&Substitution>
pub fn type_parameters(&self) -> Option<&Substitution>
Returns the type parameters of this type if it has some (i.e. is an ADT or function); so
if self
is an Option<u32>
, this returns the u32
sourcepub fn type_parameters_mut(&mut self) -> Option<&mut Substitution>
pub fn type_parameters_mut(&mut self) -> Option<&mut Substitution>
Returns a mutable reference to the type parameters of this type if it has some (i.e. is an
ADT or function); so if self
is an Option<u32>
, this returns the u32
sourcepub fn equals_ctor(&self, other: &Ty) -> bool
pub fn equals_ctor(&self, other: &Ty) -> bool
Returns true if the other type has the same type constructor
Trait Implementations§
source§impl FromIterator<Ty> for Substitution
impl FromIterator<Ty> for Substitution
source§impl HasVisibility for Ty
impl HasVisibility for Ty
fn visibility(&self, db: &dyn HirDatabase) -> Visibility
source§impl HirDisplay for &Ty
impl HirDisplay for &Ty
source§impl HirDisplay for Ty
impl HirDisplay for Ty
impl Eq for Ty
impl StructuralEq for Ty
impl StructuralPartialEq for Ty
Auto Trait Implementations§
impl RefUnwindSafe for Ty
impl Send for Ty
impl Sync for Ty
impl Unpin for Ty
impl UnwindSafe for Ty
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.