@@ -927,8 +927,9 @@ pub const Unpack = struct {
927927 }
928928
929929 pub fn array (self : * Unpack , header : Header ) ConvertError ! UnpackArray {
930- if (header .type != .array or header .type != .fixarray ) {
931- return ConvertError .InvalidValue ;
930+ switch (header .type ) {
931+ .fixarray , .array = > {},
932+ else = > return ConvertError .InvalidValue ,
932933 }
933934
934935 return UnpackArray {
@@ -938,8 +939,9 @@ pub const Unpack = struct {
938939 }
939940
940941 pub fn map (self : * Unpack , header : Header ) ConvertError ! UnpackMap {
941- if (header .type != .map or header .type != .fixmap ) {
942- return ConvertError .InvalidValue ;
942+ switch (header .type ) {
943+ .fixmap , .map = > {},
944+ else = > return ConvertError .InvalidValue ,
943945 }
944946
945947 return UnpackMap {
@@ -965,7 +967,7 @@ pub const UnpackArray = struct {
965967 return null ;
966968 }
967969
968- return self .unpack .peek () orelse PeekError . BufferEmpty ;
970+ return try self .unpack .peek ();
969971 }
970972
971973 pub fn next (self : * UnpackArray , headerType : HeaderType ) Header {
@@ -976,7 +978,7 @@ pub const UnpackArray = struct {
976978};
977979
978980pub const UnpackMap = struct {
979- unpack : * UnpackMap ,
981+ unpack : * Unpack ,
980982 current : u32 = 0 ,
981983 len : u32 ,
982984 is_value : bool = false ,
@@ -988,7 +990,7 @@ pub const UnpackMap = struct {
988990 return null ;
989991 }
990992
991- return self .unpack .peek () orelse PeekError . BufferEmpty ;
993+ return try self .unpack .peek ();
992994 }
993995
994996 pub fn next (self : * UnpackMap , headerType : HeaderType ) Header {
0 commit comments