diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2013-03-04 21:27:36 +0100 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2013-03-04 21:27:36 +0100 |
commit | 04b08da9af0c450d645ab7389d1467308cfc2db8 (patch) | |
tree | db247935fa4f2f94408edc3acd5d0d4f997aa0d8 /src/pkg/encoding/gob/doc.go | |
parent | 917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff) | |
download | golang-upstream/1.1_hg20130304.tar.gz |
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'src/pkg/encoding/gob/doc.go')
-rw-r--r-- | src/pkg/encoding/gob/doc.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pkg/encoding/gob/doc.go b/src/pkg/encoding/gob/doc.go index 821d9a3fe..5bd61b12e 100644 --- a/src/pkg/encoding/gob/doc.go +++ b/src/pkg/encoding/gob/doc.go @@ -67,11 +67,13 @@ point values may be received into any floating point variable. However, the destination variable must be able to represent the value or the decode operation will fail. -Structs, arrays and slices are also supported. Strings and arrays of bytes are -supported with a special, efficient representation (see below). When a slice is -decoded, if the existing slice has capacity the slice will be extended in place; -if not, a new array is allocated. Regardless, the length of the resulting slice -reports the number of elements decoded. +Structs, arrays and slices are also supported. Structs encode and +decode only exported fields. Strings and arrays of bytes are supported +with a special, efficient representation (see below). When a slice +is decoded, if the existing slice has capacity the slice will be +extended in place; if not, a new array is allocated. Regardless, +the length of the resulting slice reports the number of elements +decoded. Functions and channels cannot be sent in a gob. Attempting to encode a value that contains one will fail. @@ -118,7 +120,7 @@ elements using the standard gob encoding for their type, recursively. Maps are sent as an unsigned count followed by that many key, element pairs. Empty but non-nil maps are sent, so if the sender has allocated -a map, the receiver will allocate a map even no elements are +a map, the receiver will allocate a map even if no elements are transmitted. Structs are sent as a sequence of (field number, field value) pairs. The field @@ -328,7 +330,7 @@ reserved). 01 // Add 1 to get field number 0: field[1].name 01 // 1 byte 59 // structType.field[1].name = "Y" - 01 // Add 1 to get field number 1: field[0].id + 01 // Add 1 to get field number 1: field[1].id 04 // struct.Type.field[1].typeId is 2 (signed int). 00 // End of structType.field[1]; end of structType.field. 00 // end of wireType.structType structure |