BamlDecode

Derive Macro BamlDecode 

Source
#[derive(BamlDecode)]
{
    // Attributes available to this derive:
    #[baml]
}
Expand description

Derive macro for BamlDecode trait.

Generates code to decode BAML’s CffiValueHolder format to Rust structs/enums.

§Attributes

  • #[baml(name = "...")] on the type: Specify the BAML type name
  • #[baml(name = "...")] on a field/variant: Specify the BAML field/variant name

§Example

#[derive(BamlDecode)]
#[baml(name = "UserInfo")]
struct User {
    name: String,
    #[baml(name = "email_address")]
    email: Option<String>,
}