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>,
safety: SafetyKind,
},
Impl {
generics: Generics,
self_ty: Ty,
of_trait: (GlobalId, Vec<GenericValue>),
items: Vec<ImplItem>,
parent_bounds: Vec<(ImplExpr, ImplIdent)>,
},
Alias {
name: GlobalId,
item: GlobalId,
},
Use {
path: Vec<String>,
is_external: bool,
rename: Option<String>,
},
Quote {
quote: Quote,
origin: ItemQuoteOrigin,
},
RustModule,
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
safety: SafetyKindSafe or unsafe
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)
}
}Fields
of_trait: (GlobalId, Vec<GenericValue>)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
RustModule
A Rust module (mod, inline or not).
This exists solely because modules can have attributes relevant to the hax engine.
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
Implementations§
Trait Implementations§
Source§impl AnyFragment for ItemKind
impl AnyFragment for ItemKind
Source§fn type_id() -> FragmentTypeId
fn type_id() -> FragmentTypeId
Source§fn as_fragment<'a>(&'a self, type_id: FragmentTypeId) -> Option<FragmentRef<'a>>
fn as_fragment<'a>(&'a self, type_id: FragmentTypeId) -> Option<FragmentRef<'a>>
Source§fn as_owned_fragment(&self, type_id: FragmentTypeId) -> Option<Fragment>
fn as_owned_fragment(&self, type_id: FragmentTypeId) -> Option<Fragment>
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)
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)
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>
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>
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>,
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>
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>
v.visit() on the immediate contents of self.impl Eq for ItemKind
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
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Ord for ItemKind
impl Ord for ItemKind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ItemKind
impl PartialOrd for ItemKind
impl StructuralPartialEq 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>
Auto Trait Implementations§
impl Freeze for ItemKind
impl RefUnwindSafe for ItemKind
impl Send for ItemKind
impl Sync for ItemKind
impl Unpin for ItemKind
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ExtensionPoint for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
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>
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