File tree Expand file tree Collapse file tree 4 files changed +6
-4
lines changed
Expand file tree Collapse file tree 4 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -191,10 +191,12 @@ pub const Decoder = struct {
191191 const Value = std .meta .FieldType (DecodedType .KV , .value );
192192 var map = DecodedType .init (allocator );
193193 const map_len = field .size ;
194+ try map .ensureTotalCapacity (@intCast (map_len ));
195+
194196 for (0.. map_len ) | _ | {
195197 const key = try self .decodeValue (allocator , Key );
196198 const value = try self .decodeValue (allocator , Value );
197- try map .put (key , value );
199+ map .putAssumeCapacity (key , value );
198200 }
199201
200202 return map ;
Original file line number Diff line number Diff line change 11const std = @import ("std" );
22
3- pub const Names = std .hash_map . StringHashMap ([]const u8 );
3+ pub const Names = std .StringArrayHashMap ([]const u8 );
44
55/// Country represents a record in the GeoIP2-Country database, for example,
66/// https://github.com/maxmind/MaxMind-DB/blob/main/source-data/GeoIP2-Country-Test.json.
Original file line number Diff line number Diff line change 11const std = @import ("std" );
22
3- pub const Names = std .hash_map . StringHashMap ([]const u8 );
3+ pub const Names = std .StringArrayHashMap ([]const u8 );
44
55/// Country represents a record in the GeoLite2-Country database, for example,
66/// https://github.com/maxmind/MaxMind-DB/blob/main/source-data/GeoLite2-Country-Test.json.
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ pub const Metadata = struct {
2020 binary_format_minor_version : u16 = 0 ,
2121 build_epoch : u64 = 0 ,
2222 database_type : []const u8 = "" ,
23- description : ? std .hash_map . StringHashMap ([]const u8 ) = null ,
23+ description : ? std .StringArrayHashMap ([]const u8 ) = null ,
2424 ip_version : u16 = 0 ,
2525 languages : ? std .ArrayList ([]const u8 ) = null ,
2626 node_count : u32 = 0 ,
You can’t perform that action at this time.
0 commit comments