bomboni_wasm_core
Core types and utilities for generating TypeScript declarations from Rust types. This crate provides the foundation for thebomboni_wasm derive macro.
Modules
options
Configuration options for the Wasm derive macro.ts_decl
TypeScript declaration generation.ts_type
TypeScript type representations.Options Module
WasmOptions
Configuration options for the Wasm derive macro.Methods
from_derive_input
Creates WasmOptions from a DeriveInput.
FieldWasm
WASM options for a struct field.VariantWasm
WASM options for an enum variant.ReferenceChangeMap
Maps Rust reference types to TypeScript types.JsValueWasm
Configuration for customJsValue conversions.
ProxyWasm
Configuration for proxy type WASM bindings.TypeScript Declaration Module
TsDecl
TypeScript declaration enum.Methods
name
Gets the name of the declaration.
TypeAliasTsDecl
TypeScript type alias declaration.InterfaceTsDecl
TypeScript interface declaration.EnumTsDecl
TypeScript enum declaration.TsDeclParser
Parser for generating TypeScript declarations from Rust types.Methods
new
Creates a new TypeScript declaration parser.
parse
Parses the Rust type into a TypeScript declaration.
TypeScript Type Module
TsType
TypeScript type representation.Type Constants
Methods
from_type
Creates a TypeScript type from a Rust type.
nullish
Gets the nullish type for the current platform.
UNDEFINED for JavaScript targets and NULL otherwise.
is_reference
Checks if the type is a reference type.
get_reference_names
Gets all reference names used in this type.
with_tag_type
Creates a type with the given tag type.
intersection
Creates an intersection type with another type.
change_reference
Changes reference names according to the provided map.
rename_protobuf_wrapper
Renames protobuf wrapper types to their simplified forms.
DoubleValue,FloatValue→numberInt64Value,UInt64Value→stringInt32Value,UInt32Value→numberBoolValue→booleanStringValue→stringBytesValue→Uint8Array(JS) ornumber[]
KeywordTsType
TypeScript keyword types.TypeLiteralTsType
TypeScript type literal.Methods
intersection
Creates an intersection with another type literal.
TsTypeElement
TypeScript type element.Type Mapping
The library automatically maps Rust types to TypeScript types:Primitive Types
u8,u16,u32,u64,usize,i8,i16,i32,i64,isize,f32,f64→numberu128,i128→bigint(with JS feature) ornumberString,str,char,Path,PathBuf→stringbool→boolean
Container Types
Box<T>,Cow<T>,Rc<T>,Arc<T>,Cell<T>,RefCell<T>→TVec<T>,VecDeque<T>,LinkedList<T>,HashSet<T>,BTreeSet<T>→T[]HashMap<K, V>,BTreeMap<K, V>→Map<K, V>(JS) orRecord<K, V>Option<T>→T | nullorT | undefinedByteBuf→Uint8Array(JS) ornumber[]
Arrays and Tuples
- Fixed-size arrays
[T; N]where N ≤ 16 →[T, T, ...](tuple) - Larger arrays →
T[] ()(unit type) →nullorundefined
Related
- bomboni_wasm - Main WASM utilities
- bomboni_wasm_derive - Derive macro