Decode from a Uint8Array into a JavaScript value.
the buffer from which encoded data is read.
Encode a JavaScript value into a Uint8Array.
the value to be encoded into the buffer. The type accepted depends on the (sub-)type of Layout.
the buffer into which encoded data will be written.
offset
producing the offset where data for the next layout would be
written.Create an object from layout properties and an array of values.
NOTE This function returns undefined
if invoked on a layout
that does not return its value as an Object. Objects are
returned for things that are a Structure, which includes
variant layouts if they are structures, and
excludes Unions. If you want this feature for a union
you must use getVariant to select the
desired layout.
an array of values that correspond to the default order for properties. As with {@link Layout#decode|decode} layout elements that have no property name are skipped when iterating over the array values. Only the top-level properties are assigned; arguments are not assigned to properties of contained layouts. Any unused values are ignored.
Calculate the span of a specific instance of a layout.
the buffer that contains an encoded instance.
Return true
iff the external layout decodes to an unsigned
integer layout.
In that case it can be used as the source of {@link Sequence#count|Sequence counts}, {@link Blob#length|Blob lengths}, or as {@link UnionLayoutDiscriminator#layout|external union discriminators}.
Function to create an Object into which decoded properties will be written.
Used only for layouts that {@link Layout#decode|decode} to Object instances, which means:
If left undefined the JavaScript representation of these layouts will be Object instances.
Replicate the layout using a new property.
This function must be used to get a structurally-equivalent layout with a different name since all Layout instances are immutable.
NOTE This is a shallow copy. All fields except {@link Layout#property|property} are strictly equal to the origin layout.
the value for {@link Layout#property|property} in the replica.
property
.Generated using TypeDoc
An object that behaves like a layout but does not consume space within its containing layout.
This is primarily used to obtain metadata about a member, such as a OffsetLayout that can provide data about a {@link Layout#getSpan|value-specific span}.
NOTE This is an abstract base class; you can create instances if it amuses you, but they won't support {@link ExternalLayout#isCount|isCount} or other Layout functions.
initializer for {@link Layout#span|span}. The parameter can range from 1 through 6.
initializer for {@link Layout#property|property}.