pub enum ItemKind {
Fn {
name: GlobalId,
generics: Generics,
body: Expr,
params: Vec<Param>,
safety: SafetyKind,
},
TyAlias {
name: GlobalId,
generics: Generics,
ty: Ty,
},
Type {
name: GlobalId,
generics: Generics,
variants: Vec<Variant>,
is_struct: bool,
},
Trait {
name: GlobalId,
generics: Generics,
items: Vec<TraitItem>,
},
Impl {
generics: Generics,
self_ty: Ty,
of_trait: (GlobalId, Vec<GenericValue>),
items: Vec<ImplItem>,
parent_bounds: Vec<(ImplExpr, ImplIdent)>,
safety: SafetyKind,
},
Alias {
name: GlobalId,
item: GlobalId,
},
Use {
path: Vec<String>,
is_external: bool,
rename: Option<String>,
},
Quote {
quote: Quote,
origin: ItemQuoteOrigin,
},
Error(ErrorNode),
Resugared(ResugaredItemKind),
NotImplementedYet,
}Expand description
A top-level item in the module.
Variants§
Fn
A function or constant item.
§Example:
ⓘ
fn add<T: Clone>(x: i32, y: i32) -> i32 {
x + y
}Constants are represented as functions of arity zero, while functions always have a non-zero arity.
Fields
§
generics: GenericsThe generic arguments and constraints of the function.
§Example:
the generic type T and the constraint T: Clone
§
safety: SafetyKindThe safety of the function.
TyAlias
Fields
Type
Fields
Trait
Fields
Impl
A trait implementation.
§Example:
ⓘ
impl T<u8> for u16 {
type Assoc = u32;
fn m(x: u32, y: u16) -> u8 {
(x as u8) + (y as u8)
}
}Alias
Internal node introduced by phases, corresponds to an alias to any item.
Use
A use statement
Fields
Quote
A Quote node is inserted by phase TransformHaxLibInline to deal with some hax_lib features.
For example insertion of verbatim backend code.
Fields
§
origin: ItemQuoteOriginDescription of the quote target position
Error(ErrorNode)
Fallback constructor to carry errors.
Resugared(ResugaredItemKind)
A resugared item. This variant is introduced before printing only. Phases must not produce this variant.
NotImplementedYet
Item that is not implemented yet
Trait Implementations§
Source§impl AstVisitable for ItemKind
impl AstVisitable for ItemKind
Source§fn drive_map<V: AstVisitorMut>(&mut self, v: &mut V)
fn drive_map<V: AstVisitorMut>(&mut self, v: &mut V)
Recursively visit this type with the provided visitor. This calls the visitor’s
visit_$any
method if it exists, otherwise visit_inner.Source§fn drive<V: AstVisitor>(&self, v: &mut V)
fn drive<V: AstVisitor>(&self, v: &mut V)
Recursively visit this type with the provided visitor. This calls the visitor’s
visit_$any
method if it exists, otherwise visit_inner.Source§impl AstVisitable for ItemKind
impl AstVisitable for ItemKind
Source§fn drive<V: AstEarlyExitVisitor>(&self, v: &mut V) -> ControlFlow<V::Break>
fn drive<V: AstEarlyExitVisitor>(&self, v: &mut V) -> ControlFlow<V::Break>
Recursively visit this type with the provided visitor. This calls the visitor’s
visit_$any
method if it exists, otherwise visit_inner.Source§fn drive_mut<V: AstEarlyExitVisitorMut>(
&mut self,
v: &mut V,
) -> ControlFlow<V::Break>
fn drive_mut<V: AstEarlyExitVisitorMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>
Recursively visit this type with the provided visitor. This calls the visitor’s
visit_$any
method if it exists, otherwise visit_inner.Source§impl<'de> Deserialize<'de> for ItemKind
impl<'de> Deserialize<'de> for ItemKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'s, V> Drive<'s, V> for ItemKindwhere
V: Visitor + Visit<'s, GlobalId> + Visit<'s, Generics> + Visit<'s, Expr> + Visit<'s, Vec<Param>> + Visit<'s, SafetyKind> + Visit<'s, Ty> + Visit<'s, Vec<Variant>> + Visit<'s, bool> + Visit<'s, Vec<TraitItem>> + Visit<'s, (GlobalId, Vec<GenericValue>)> + Visit<'s, Vec<ImplItem>> + Visit<'s, Vec<(ImplExpr, ImplIdent)>> + Visit<'s, Vec<String>> + Visit<'s, Option<String>> + Visit<'s, Quote> + Visit<'s, ItemQuoteOrigin> + Visit<'s, ErrorNode> + Visit<'s, ResugaredItemKind>,
impl<'s, V> Drive<'s, V> for ItemKindwhere
V: Visitor + Visit<'s, GlobalId> + Visit<'s, Generics> + Visit<'s, Expr> + Visit<'s, Vec<Param>> + Visit<'s, SafetyKind> + Visit<'s, Ty> + Visit<'s, Vec<Variant>> + Visit<'s, bool> + Visit<'s, Vec<TraitItem>> + Visit<'s, (GlobalId, Vec<GenericValue>)> + Visit<'s, Vec<ImplItem>> + Visit<'s, Vec<(ImplExpr, ImplIdent)>> + Visit<'s, Vec<String>> + Visit<'s, Option<String>> + Visit<'s, Quote> + Visit<'s, ItemQuoteOrigin> + Visit<'s, ErrorNode> + Visit<'s, ResugaredItemKind>,
Source§fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
Call
v.visit() on the immediate contents of self.Source§impl<'s, V> DriveMut<'s, V> for ItemKindwhere
V: Visitor + VisitMut<'s, GlobalId> + VisitMut<'s, Generics> + VisitMut<'s, Expr> + VisitMut<'s, Vec<Param>> + VisitMut<'s, SafetyKind> + VisitMut<'s, Ty> + VisitMut<'s, Vec<Variant>> + VisitMut<'s, bool> + VisitMut<'s, Vec<TraitItem>> + VisitMut<'s, (GlobalId, Vec<GenericValue>)> + VisitMut<'s, Vec<ImplItem>> + VisitMut<'s, Vec<(ImplExpr, ImplIdent)>> + VisitMut<'s, Vec<String>> + VisitMut<'s, Option<String>> + VisitMut<'s, Quote> + VisitMut<'s, ItemQuoteOrigin> + VisitMut<'s, ErrorNode> + VisitMut<'s, ResugaredItemKind>,
impl<'s, V> DriveMut<'s, V> for ItemKindwhere
V: Visitor + VisitMut<'s, GlobalId> + VisitMut<'s, Generics> + VisitMut<'s, Expr> + VisitMut<'s, Vec<Param>> + VisitMut<'s, SafetyKind> + VisitMut<'s, Ty> + VisitMut<'s, Vec<Variant>> + VisitMut<'s, bool> + VisitMut<'s, Vec<TraitItem>> + VisitMut<'s, (GlobalId, Vec<GenericValue>)> + VisitMut<'s, Vec<ImplItem>> + VisitMut<'s, Vec<(ImplExpr, ImplIdent)>> + VisitMut<'s, Vec<String>> + VisitMut<'s, Option<String>> + VisitMut<'s, Quote> + VisitMut<'s, ItemQuoteOrigin> + VisitMut<'s, ErrorNode> + VisitMut<'s, ResugaredItemKind>,
Source§fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
Call
v.visit() on the immediate contents of self.Source§impl<'lt> From<&'lt ItemKind> for FragmentRef<'lt>
impl<'lt> From<&'lt ItemKind> for FragmentRef<'lt>
Source§impl JsonSchema for ItemKind
impl JsonSchema for ItemKind
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl Ord for ItemKind
impl Ord for ItemKind
Source§impl PartialOrd for ItemKind
impl PartialOrd for ItemKind
Source§impl<A: 'static + Clone, P: PrettyAst<A>> ToDocument<P, A> for ItemKind
impl<A: 'static + Clone, P: PrettyAst<A>> ToDocument<P, A> for ItemKind
Source§fn to_document(&self, printer: &P) -> DocBuilder<A>
fn to_document(&self, printer: &P) -> DocBuilder<A>
Produce a document using the provided printer reference.
impl Eq for ItemKind
impl StructuralPartialEq for ItemKind
Auto Trait Implementations§
impl Freeze for ItemKind
impl RefUnwindSafe for ItemKind
impl Send for ItemKind
impl Sync for ItemKind
impl Unpin for ItemKind
impl UnwindSafe for ItemKind
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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