pub struct Variant { /* private fields */ }
Implementations§
source§impl Variant
impl Variant
pub fn module(self, db: &dyn HirDatabase) -> Module
pub fn parent_enum(self, db: &dyn HirDatabase) -> Enum
pub fn constructor_ty(self, db: &dyn HirDatabase) -> Type
pub fn name(self, db: &dyn HirDatabase) -> Name
pub fn fields(self, db: &dyn HirDatabase) -> Vec<Field>
pub fn kind(self, db: &dyn HirDatabase) -> StructKind
pub fn value(self, db: &dyn HirDatabase) -> Option<Expr>
pub fn eval(self, db: &dyn HirDatabase) -> Result<i128, ConstEvalError>
pub fn layout(&self, db: &dyn HirDatabase) -> Result<Layout, LayoutError>
pub fn is_unstable(self, db: &dyn HirDatabase) -> bool
Trait Implementations§
source§impl From<&Variant> for DefWithBodyId
impl From<&Variant> for DefWithBodyId
source§impl From<EnumVariantId> for Variant
impl From<EnumVariantId> for Variant
source§fn from(id: EnumVariantId) -> Self
fn from(id: EnumVariantId) -> Self
Converts to this type from the input type.
source§impl From<Variant> for DefWithBody
impl From<Variant> for DefWithBody
source§fn from(it: Variant) -> DefWithBody
fn from(it: Variant) -> DefWithBody
Converts to this type from the input type.
source§impl From<Variant> for EnumVariantId
impl From<Variant> for EnumVariantId
source§impl From<Variant> for GenericDef
impl From<Variant> for GenericDef
source§fn from(it: Variant) -> GenericDef
fn from(it: Variant) -> GenericDef
Converts to this type from the input type.
source§impl From<Variant> for VariantDef
impl From<Variant> for VariantDef
source§fn from(it: Variant) -> VariantDef
fn from(it: Variant) -> VariantDef
Converts to this type from the input type.
source§impl HasAttrs for Variant
impl HasAttrs for Variant
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner
source§impl HasVisibility for Variant
impl HasVisibility for Variant
Variants inherit visibility from the parent enum.
fn visibility(&self, db: &dyn HirDatabase) -> Visibility
fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool
source§impl HirDisplay for Variant
impl HirDisplay for Variant
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>
source§fn into_displayable<'a>(
&'a self,
db: &'a dyn HirDatabase,
max_size: Option<usize>,
limited_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>,
limited_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget,
closure_style: ClosureStyle
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Display
able 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
Display
able 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
Display
able 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_limited<'a>(
&'a self,
db: &'a dyn HirDatabase,
limited_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
fn display_limited<'a>(
&'a self,
db: &'a dyn HirDatabase,
limited_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>where
Self: Sized,
Returns a
Display
able 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
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 Variant
impl PartialEq for Variant
impl Copy for Variant
impl Eq for Variant
impl StructuralPartialEq for Variant
Auto Trait Implementations§
impl Freeze for Variant
impl RefUnwindSafe for Variant
impl Send for Variant
impl Sync for Variant
impl Unpin for Variant
impl UnwindSafe for Variant
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> Cast for T
impl<T> Cast for T
source§fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere
Self: CastTo<U>,
U: HasInterner,
Cast a value to type
U
using CastTo
.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.