CborBuilder
constCborBuilder:object
Defined in: ootle/src/helpers/cbor-builder.ts:298
Entry point for building struct, enum, list and map arguments. Builders nest: pass one to
another’s field/add, and call finish() on the outermost only.
const arg = CborBuilder.struct() .field(0, "name") .field(1, CborBuilder.array([1, 2, 3])) .field(2, CborBuilder.variant(1).field(0, true)) .finish();Type Declaration
Section titled “Type Declaration”
readonlyarray: (items) =>CborArrayBuilder
A Vec or tuple.
Parameters
Section titled “Parameters”items?
Section titled “items?”CborValue[] = []
Returns
Section titled “Returns”
readonlymap: () =>CborMapBuilder
A BTreeMap or HashMap. Entries are written in a fixed order, whatever order they were added in.
Returns
Section titled “Returns”struct
Section titled “struct”
readonlystruct: () =>CborStructBuilder
A Rust struct: fields are set by their #[n(i)] index.
Returns
Section titled “Returns”variant
Section titled “variant”
readonlyvariant: (index) =>CborVariantBuilder
A Rust enum value: index is the variant’s #[n(i)]. An enum marked
#[cbor(index_only)] is written as the bare index instead: pass the number itself.
Parameters
Section titled “Parameters”number