Expand description

Record definitions for a ComponentInterface.

This module converts “dictionary” definitions from UDL into Record structures that can be added to a ComponentInterface, which are the main way we define structured data types for a UniFFI Rust Component. A Record has a fixed set of named fields, each of a specific type.

(The terminology mismatch between “dictionary” and “record” is a historical artifact due to this tool being loosely inspired by WebAssembly Interface Types, which used the term “record” for this sort of data).

A declaration in the UDL like this:

dictionary Example {
  string name;
  u32 value;
};

Will result in a Record member with two Fields being added to the resulting crate::ComponentInterface:

let record = ci.get_record_definition("Example").unwrap();
assert_eq!(record.name(), "Example");
assert_eq!(record.fields()[0].name(), "name");
assert_eq!(record.fields()[1].name(), "value");

Structs

  • Represents a “data class” style object, for passing around complex values.