@recodeType("TEST") // Set the HiBONRecord type name struct Test { @label("$X") uint x; // The member in HiBON is "$X" string name; // The member in HiBON is "name" @label("num") int num; // The member in HiBON is "num" and is optional @optional string text; // optional hibon member @exclude bool dummy; // This parameter is not included in the HiBON }
CTOR = is used for constructor
struct TestCtor { uint x; HiBONRecord!("TEST2", q{ this(uint x) { this.x=x; } } ); }
/// Reseved keys and types { /// Check for reseved HiBON types @recordType("$@") static struct S { int x; mixin HiBONRecord; } S s; const doc = s.toDoc; assert(doc.valid is Document.Element.ErrorCode.RESERVED_HIBON_TYPE); } { /// Check for reseved keys static struct S { @label("$@x") int x; mixin HiBONRecord; } S s; const doc = s.toDoc; assert(doc.valid is Document.Element.ErrorCode.RESERVED_KEY); }
HiBON Helper template to implement constructor and toHiBON member functions