Crate cml_core_wasm

source ·

Modules§

Macros§

  • Implements to/from CBOR bytes API for WASM wrappers using CML’s Serialize i.e. it remembers encodings
  • Implements to/from CBOR bytes API for WASM wrappers using cbor_event’s Serialize i.e. it does not remember encodings
  • We use this instead of cml_core::impl_wasm_cbor_json_api for types that do not implement cml’s Serialize. e.g. CIP25/Byron just do cbor_event’s due to not supporting preserve-encodings=true All other methods are identical to impl_wasm_cbor_json_api though.
  • Various code-generation macros to help with WASM wrapper creation. Includes many things that auto-generated by cddl-codegen so we can use these with utility code that had to be hand-written. Auto-declare From/AsRef conversions between rust and WASM wrappers
  • Implements the to/from JSON + JS object API for WASM wrappers
  • Convenience creator for generic WASM-exposable list This is exactly as the ones created by cddl-codegen so it is useful for utility functionality where those wouldn’t have been automatically generated.
  • This shouldn’t be explicitly called - only via impl_wasm_list!() We use this to get around restrictions in outer macros evaluating before inner macros which breaks wasm_bindgen’s parameter parsing resulting in FromWasmAbi on &T instead See comment for impl_wasm_map_insert_get! for more context
  • Convenience creator for generic WASM-exposable map This is exactly as the ones created by cddl-codegen so it is useful for utility functionality where those wouldn’t have been automatically generated.
  • Useful for Byron/cip25/etc where we don’t use OrderedHashMap
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here
  • This shouldn’t be explicitly called - only via impl_wasm_map!() We use this to get around restrictions in outer macros evaluating before inner macros which breaks wasm_bindgen’s parameter parsing resulting in FromWasmAbi on &T instead of RefFromWasmAbi on T being used. This happened when these were inlined directly in impl_wasm_map!() e.g.:
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here This is here due to problems with AsRef vs & in impl_wasm_get expression, e is wasm-exposable
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here expression, e is Copy
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here expression, e is Copy
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here expression, e is wasm-exposable
  • This shouldn’t be explicitly called - only via impl_wasm_* macros here expression, e is wasm-exposable

Structs§