Maps each key in E
to a type capable of writing
the type of value stored by that key in E
Gets the recursive type registered with the specified name
The name of the registered type
The registered type
Returns whether the specified name already has a recursive type registered with it from a call to registerType
The name to check
Whether the name has been mapped to a type
Registers a type with a name so the name can be used in a RecursiveType. Due to implementation limitations, the type must be one of the following types:
If you need to use a different type, wrap it in a single-field StructType.
THIS METHOD OF REGISTERING RECURSIVE TYPES HAS BEEN DEPRECATED. Instead, please use RecursiveType.setType:
//A binary tree of unsigned bytes
let treeType = new sb.RecursiveType('tree-node')
treeType.setType(new sb.StructType({
left: new sb.OptionalType(treeType),
value: new sb.UnsignedByteType,
right: new sb.OptionalType(treeType)
}))
Example:
//A binary tree of unsigned bytes
let treeType = new sb.RecursiveType('tree-node')
sb.registerType({
type: new sb.StructType({
left: new sb.OptionalType(treeType),
value: new sb.UnsignedByteType,
right: new sb.OptionalType(treeType)
}),
name: 'tree-node' //name must match name passed to RecursiveType constructor
})
Generated using TypeDoc
structure-bytes
exports the following named members:io
read
r.type
recursive-registry
types