BamlEncode

Derive Macro BamlEncode 

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

Derive macro for BamlEncode trait.

Generates code to encode Rust structs/enums to BAML’s HostValue format.

§Attributes

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

§Example

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