Skip to content

Commit

Permalink
Add brief documentation for the MapField type
Browse files Browse the repository at this point in the history
Signed-off-by: Nic Cope <[email protected]>
  • Loading branch information
negz committed Oct 2, 2023
1 parent 2531872 commit eb7d2e4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
// msg.uints32s = [1, 2, 3]
// print(type(msg.uints32s)) # "proto.repeated<uint32>"
//
// The value of a map field of a message is represented by the dict-like data
// type, MapField. Its items can be set and access in the usual ways. As with
// assignments to message fields, and assignment to a MapField performs a
// dynamic check to ensure the key and value are of the correct type.
//
// msg.string_map = {"a": "A", "b", "B"}
// msg.string_map["c"] = "C"
// print(type(msg.string_map)) # "proto.map<string, string>"
//
// To construct a Message from encoded binary or text data, call
// Unmarshal or UnmarshalText. These two functions are exposed to
// Starlark programs as proto.unmarshal{,_text}.
Expand Down

0 comments on commit eb7d2e4

Please sign in to comment.