Skip to content

Commit

Permalink
Update documentation with sizefrom and boolean flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Chadwick committed Mar 23, 2019
1 parent 1af4ff3 commit d6da248
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions packing.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,28 @@ following struct tag syntax is supported:
Flags are comma-separated keys. The following are available:
type A bare type name, e.g. int32 or []string.
type A bare type name, e.g. int32 or []string.
sizeof=[Field] Specifies that the field should be treated as a count of
the number of elements in Field.
sizeof=[Field] Specifies that the field should be treated as a count of
the number of elements in Field.
skip=[Count] Skips Count bytes before the field. You can use this to
e.g. emulate C structure alignment.
sizefrom=[Field] Specifies that the field should determine the number of
elements in itself by reading the counter in Field.
big,msb Specifies big endian byte order. When applied to structs,
this will apply to all fields under the struct.
skip=[Count] Skips Count bytes before the field. You can use this to
e.g. emulate C structure alignment.
little,lsb Specifies little endian byte order. When applied to structs,
this will apply to all fields under the struct.
big,msb Specifies big endian byte order. When applied to
structs, this will apply to all fields under the struct.
little,lsb Specifies little endian byte order. When applied to
structs, this will apply to all fields under the struct.
variantbool Specifies that the boolean `true` value should be
encoded as -1 instead of 1.
invertedbool Specifies that the `true` and `false` encodings for
boolean should be swapped.
*/
func Unpack(data []byte, order binary.ByteOrder, v interface{}) (err error) {
defer func() {
Expand Down

0 comments on commit d6da248

Please sign in to comment.