Implement {@link Layout#encode|encode} for Structure.
If src
is missing a property for a member with a defined {@link
Layout#property|property} the corresponding region of the buffer is
left unmodified.
Get access to the layout of a given property.
the structure member of interest.
property
, or
undefined if there is no such property.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.
Get the offset of a structure member.
the structure member of interest.
property
within the structure, or undefined if property
is not a field
within the structure. If the property is a member but follows a
variable-length structure member a negative number will be
returned.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
Represent a contiguous sequence of arbitrary layout elements as an Object.
Factory: {@link module:Layout.struct|struct}
NOTE The {@link Layout#span|span} of the structure is variable if any layout in {@link Structure#fields|fields} has a variable span. When {@link Layout#encode|encoding} we must have a value for all variable-length fields, or we wouldn't be able to figure out how much space to use for storage. We can only identify the value for a field when it has a {@link Layout#property|property}. As such, although a structure may contain both unnamed fields and variable-length fields, it cannot contain an unnamed variable-length field.
initializer for {@link Structure#fields|fields}. An error is raised if this contains a variable-length field for which a {@link Layout#property|property} is not defined.
initializer for {@link Layout#property|property}.
initializer for {@link Structure#decodePrefixes|property}.
{Error} - if
fields
contains an unnamed variable-length layout.