pub struct FieldDef {
pub name: String,
pub type_name: String,
pub description: String,
pub fixed_size: Option<u32>,
pub max_len: Option<u32>,
pub optional: bool,
pub slot_offset: u32,
pub section: FieldSection,
pub discriminant_value: u16,
pub serde_rename: Option<String>,
pub domain_type: Option<String>,
}Fields§
§name: String§type_name: String§description: String§fixed_size: Option<u32>From $fixedSize(N) annotation: generates [u8; N] instead of Vec<u8> for Data fields.
max_len: Option<u32>From $maxLen(N) annotation: Text fields reject decoded values longer
than N at the borrowed reader, before any owned String is allocated.
optional: boolFrom $optional annotation: field is optional in MCP tool schemas and uses
type-appropriate zero-value defaults when absent at runtime.
slot_offset: u32Slot offset from CGR (field::slot::get_offset()). For data section fields, this is the word-level offset. For pointer section fields, this is the pointer index.
section: FieldSectionWhich section this field lives in (data section or pointer section).
discriminant_value: u16Discriminant value for union fields (0xFFFF means non-union).
serde_rename: Option<String>From $serdeRename("...") annotation: generates #[serde(rename = "...")] on the Rust field.
domain_type: Option<String>From a field-level $domainType("path::Type") annotation: the field maps to this
Rust newtype while keeping its capnp wire type (e.g. Text). The generated struct
uses this type; ToCapnp writes via .as_str() and FromCapnp reads via Type::new(...).