diff options
author | Chris Fallin <cfallin@c1f.net> | 2015-01-06 18:01:32 -0800 |
---|---|---|
committer | Chris Fallin <cfallin@c1f.net> | 2015-01-06 18:01:32 -0800 |
commit | 80276ac0218f6d8fcdbad0fb09b233b31d2bc0fb (patch) | |
tree | 9500a829302bcc5c490aeb28c0fbe77b580b424f /ruby/ext/google/protobuf_c/map.c | |
parent | fd1a3ff11d5854c34ba66c63598cdc5fd234e399 (diff) | |
download | protobuf-80276ac0218f6d8fcdbad0fb09b233b31d2bc0fb.tar.gz protobuf-80276ac0218f6d8fcdbad0fb09b233b31d2bc0fb.tar.bz2 protobuf-80276ac0218f6d8fcdbad0fb09b233b31d2bc0fb.zip |
Addressed code-review comments.
Diffstat (limited to 'ruby/ext/google/protobuf_c/map.c')
-rw-r--r-- | ruby/ext/google/protobuf_c/map.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ruby/ext/google/protobuf_c/map.c b/ruby/ext/google/protobuf_c/map.c index 9d5de9cd..56548799 100644 --- a/ruby/ext/google/protobuf_c/map.c +++ b/ruby/ext/google/protobuf_c/map.c @@ -32,6 +32,17 @@ // ----------------------------------------------------------------------------- // Basic map operations on top of upb's strtable. +// +// Note that we roll our own `Map` container here because, as for +// `RepeatedField`, we want a strongly-typed container. This is so that any user +// errors due to incorrect map key or value types are raised as close as +// possible to the error site, rather than at some deferred point (e.g., +// serialization). +// +// We build our `Map` on top of upb_strtable so that we're able to take +// advantage of the native_slot storage abstraction, as RepeatedField does. +// (This is not quite a perfect mapping -- see the key conversions below -- but +// gives us full support and error-checking for all value types for free.) // ----------------------------------------------------------------------------- // Map values are stored using the native_slot abstraction (as with repeated |