#[repr(C)]pub struct oscore_msg_native_t(/* private fields */);
Expand description
The message type is conveniently already more pointer-like; given that we pass around pointers to a concrete type (albeit possibly an enum), it’s just that.
The current convention this crate adheres to is to go through a level of indirection (being a pointer to the Message enum) rather than the full enum itself. The latter is well within the design space of libOSCORE, but given that there is as of 2022 some confusion about WASM’s ABI (C and Rust-on-some-target-triples disagree on whether they are passed by value or by reference on the ABI level when passed by value on the API level), a small struct is preferable.
If &dyn the-required-traits
were possible, we could also pass that (subject to the same
limitations as passing the full enum).
The void pointer hides a [Message] enum (because it can’t be repr(C)) that always has “sufficient” lifetime (we have to trust the C side on that).