pub struct EnumVariant {
pub(crate) id: EnumVariantId,
}Fields§
§id: EnumVariantIdImplementations§
Source§impl EnumVariant
impl EnumVariant
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
pub fn instantiate_infer<'db>( self, infer_ctxt: &InferCtxt<'db>, ) -> InstantiatedVariant<'db>
Trait Implementations§
Source§impl Clone for EnumVariant
impl Clone for EnumVariant
Source§fn clone(&self) -> EnumVariant
fn clone(&self) -> EnumVariant
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnumVariant
impl Debug for EnumVariant
Source§impl From<&EnumVariant> for DefWithBodyId
impl From<&EnumVariant> for DefWithBodyId
Source§fn from(v: &EnumVariant) -> Self
fn from(v: &EnumVariant) -> Self
Converts to this type from the input type.
Source§impl From<EnumVariant> for DefWithBody
impl From<EnumVariant> for DefWithBody
Source§fn from(it: EnumVariant) -> DefWithBody
fn from(it: EnumVariant) -> DefWithBody
Converts to this type from the input type.
Source§impl From<EnumVariant> for EnumVariantId
impl From<EnumVariant> for EnumVariantId
Source§fn from(def: EnumVariant) -> Self
fn from(def: EnumVariant) -> Self
Converts to this type from the input type.
Source§impl From<EnumVariant> for ModuleDef
impl From<EnumVariant> for ModuleDef
Source§fn from(it: EnumVariant) -> ModuleDef
fn from(it: EnumVariant) -> ModuleDef
Converts to this type from the input type.
Source§impl From<EnumVariant> for Variant
impl From<EnumVariant> for Variant
Source§fn from(it: EnumVariant) -> Variant
fn from(it: EnumVariant) -> Variant
Converts to this type from the input type.
Source§impl From<EnumVariantId> for EnumVariant
impl From<EnumVariantId> for EnumVariant
Source§impl HasAttrs for EnumVariant
impl HasAttrs for EnumVariant
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner
fn hir_docs(self, db: &dyn HirDatabase) -> Option<&Docs>
Source§impl HasCrate for EnumVariant
impl HasCrate for EnumVariant
fn krate(&self, db: &dyn HirDatabase) -> Crate
Source§impl HasName for EnumVariant
impl HasName for EnumVariant
Source§impl HasSource for EnumVariant
impl HasSource for EnumVariant
type Ast = Variant
Source§fn source(self, db: &dyn HirDatabase) -> Option<InFile<Variant>>
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Variant>>
Fetches the definition’s source node.
Using
crate::SemanticsImpl::source is preferred when working with crate::Semantics,
as that caches the parsed file in the semantics’ cache. Read moreSource§fn source_with_range(
self,
db: &dyn HirDatabase,
) -> Option<InFile<(TextRange, Option<Self::Ast>)>>
fn source_with_range( self, db: &dyn HirDatabase, ) -> Option<InFile<(TextRange, Option<Self::Ast>)>>
Fetches the source node, along with its full range. Read more
Source§impl HasVisibility for EnumVariant
Variants inherit visibility from the parent enum.
impl HasVisibility for EnumVariant
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 Hash for EnumVariant
impl Hash for EnumVariant
Source§impl<'db> HirDisplay<'db> for EnumVariant
impl<'db> HirDisplay<'db> for EnumVariant
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 functionsSource§impl PartialEq for EnumVariant
impl PartialEq for EnumVariant
impl Copy for EnumVariant
impl Eq for EnumVariant
impl StructuralPartialEq for EnumVariant
Auto Trait Implementations§
impl Freeze for EnumVariant
impl RefUnwindSafe for EnumVariant
impl Send for EnumVariant
impl Sync for EnumVariant
impl Unpin for EnumVariant
impl UnwindSafe for EnumVariant
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