erlang: Add a more detailed spec for thrift_protocol:read
authorDavid Reiss <dreiss@apache.org>
Mon, 30 Aug 2010 22:05:25 +0000 (22:05 +0000)
committerDavid Reiss <dreiss@apache.org>
Mon, 30 Aug 2010 22:05:25 +0000 (22:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@990976 13f79535-47bb-0310-9956-ffa450edef68

lib/erl/include/thrift_protocol.hrl
lib/erl/include/thrift_protocol_impl.hrl
lib/erl/src/thrift_protocol.erl

index 201bade..f85f455 100644 (file)
                         | double
                         | string
                         .
+-type tprot_cont_tag() :: {list, _Type}
+                        | {map, _KType, _VType}
+                        | {set, _Type}
+                        .
 
 
 -endif.
index fe9d20d..92f3a00 100644 (file)
@@ -27,6 +27,7 @@
 
 -spec write(state(), term()) -> ok | {error, _Reason}.
 
+%% NOTE: Keep this in sync with thrift_protocol:read.
 -spec read
         (state(), tprot_empty_tag()) ->   ok                | {error, _Reason};
         (state(), tprot_header_tag()) -> tprot_header_val() | {error, _Reason};
index 3ccb4ee..a207bca 100644 (file)
@@ -115,7 +115,14 @@ read(IProto, {struct, Structure}, Tag)
     RTuple2 = read_struct_loop(IProto, SDict, RTuple1),
     {ok, RTuple2}.
 
--spec read(#protocol{}, term()) -> term().
+
+%% NOTE: Keep this in sync with thrift_protocol_impl:read
+-spec read
+        (#protocol{}, {struct, _Info}) ->    {ok, tuple()}      | {error, _Reason};
+        (#protocol{}, tprot_cont_tag()) ->   {ok, term()}       | {error, _Reason};
+        (#protocol{}, tprot_empty_tag()) ->   ok                | {error, _Reason};
+        (#protocol{}, tprot_header_tag()) -> tprot_header_val() | {error, _Reason};
+        (#protocol{}, tprot_data_tag()) ->   {ok, term()}       | {error, _Reason}.
 
 read(IProto, {struct, {Module, StructureName}}) when is_atom(Module),
                                                      is_atom(StructureName) ->