Module emit

Module emit 

Source
Expand description

A bunch of utilities used by the actual code emit functions

Structs§

Mod
A representation of a module definition that we will eventually emit. This is used to allow easily adding onto the module each time we see a relevant decl.
State
A whole grab-bag of useful state to have while emitting Rust
Trait
A representation of a trait definition that we will eventually emit. This is used to allow easily adding onto the trait each time we see an extern decl.
WitName
A parsed representation of a WIT name, containing package namespaces, an actual name, and possibly a SemVer version

Enums§

FnName
The kinds of names that a function in WIT can have
ResolvedBoundVar
Unlike [tv::ResolvedTyvar], which is mostly concerned with free variables and leaves bound variables alone, this tells us the most information that we have at codegen time for a top level bound variable.
ResourceItemName
The kinds of names that a function associated with a resource in WIT can have

Functions§

kebab_to_cons
Convert a kebab name to something suitable for use as a type constructor
kebab_to_exports_name
From a kebab name for a Component, derive something suitable for use as the name of the imports trait for that component
kebab_to_fn
Parse a kebab-name as a WIT function name, figuring out if it is associated with a resource
kebab_to_getter
Convert a kebab name to something suitable for use as a getter function name
kebab_to_imports_name
From a kebab name for a Component, derive something suitable for use as the name of the imports trait for that component
kebab_to_namespace
Convert a kebab name to something suitable for use as a module name/namespace path entry
kebab_to_type
Convert a kebab name to something suitable for use as a type name
kebab_to_var
Convert a kebab name to something suitable for use as a (value-level) variable
run_state
Create a State with all of its &mut references pointing to sensible things, run a function that emits code into the state, and then generate a token stream representing everything emitted
split_wit_name
Parse a kebab-name as a WIT name