@@ -8,13 +8,11 @@ pub const Names = std.StringArrayHashMap([]const u8);
88/// It can be used for geolocation at the country-level for analytics, content customization,
99/// or compliance use cases in territories that are not disputed.
1010pub const Country = struct {
11- continent : Self.Continent ,
12- country : Self.Country ,
13- registered_country : Self.Country ,
14- represented_country : Self.RepresentedCountry ,
15- traits : Self.Traits ,
16-
17- _arena : std.heap.ArenaAllocator ,
11+ continent : Self.Continent = .{},
12+ country : Self.Country = .{},
13+ registered_country : Self.Country = .{},
14+ represented_country : Self.RepresentedCountry = .{},
15+ traits : Self.Traits = .{},
1816
1917 const Self = @This ();
2018 pub const Continent = struct {
@@ -38,42 +36,22 @@ pub const Country = struct {
3836 pub const Traits = struct {
3937 is_anycast : bool = false ,
4038 };
41-
42- pub fn init (allocator : std.mem.Allocator ) Self {
43- const arena = std .heap .ArenaAllocator .init (allocator );
44-
45- return .{
46- .continent = .{},
47- .country = .{},
48- .registered_country = .{},
49- .represented_country = .{},
50- .traits = .{},
51-
52- ._arena = arena ,
53- };
54- }
55-
56- pub fn deinit (self : * const Self ) void {
57- self ._arena .deinit ();
58- }
5939};
6040
6141/// City represents a record in the GeoIP2-City database, for example,
6242/// https://github.com/maxmind/MaxMind-DB/blob/main/source-data/GeoIP2-City-Test.json.
6343///
6444/// It can be used for geolocation down to the city or postal code for analytics and content customization.
6545pub const City = struct {
66- city : Self.City ,
67- continent : Country.Continent ,
68- country : Country.Country ,
69- location : Self.Location ,
70- postal : Self.Postal ,
71- registered_country : Country.Country ,
72- represented_country : Country.RepresentedCountry ,
46+ city : Self.City = .{} ,
47+ continent : Country.Continent = .{} ,
48+ country : Country.Country = .{} ,
49+ location : Self.Location = .{} ,
50+ postal : Self.Postal = .{} ,
51+ registered_country : Country.Country = .{} ,
52+ represented_country : Country.RepresentedCountry = .{} ,
7353 subdivisions : ? std .ArrayList (Self .Subdivision ) = null ,
74- traits : Country.Traits ,
75-
76- _arena : std.heap.ArenaAllocator ,
54+ traits : Country.Traits = .{},
7755
7856 const Self = @This ();
7957 pub const City = struct {
@@ -95,45 +73,22 @@ pub const City = struct {
9573 iso_code : []const u8 = "" ,
9674 names : ? Names = null ,
9775 };
98-
99- pub fn init (allocator : std.mem.Allocator ) Self {
100- const arena = std .heap .ArenaAllocator .init (allocator );
101-
102- return .{
103- .city = .{},
104- .continent = .{},
105- .country = .{},
106- .location = .{},
107- .postal = .{},
108- .registered_country = .{},
109- .represented_country = .{},
110- .traits = .{},
111-
112- ._arena = arena ,
113- };
114- }
115-
116- pub fn deinit (self : * const Self ) void {
117- self ._arena .deinit ();
118- }
11976};
12077
12178/// Enterprise represents a record in the GeoIP2-Enterprise database, for example,
12279/// https://github.com/maxmind/MaxMind-DB/blob/main/source-data/GeoIP2-Enterprise-Test.json.
12380/// Determine geolocation data such as country, region, state, city, ZIP/postal code,
12481/// and additional intelligence such as confidence factors, ISP, domain, and connection type.
12582pub const Enterprise = struct {
126- city : Self.City ,
127- continent : Self.Continent ,
128- country : Self.Country ,
129- location : Self.Location ,
130- postal : Self.Postal ,
131- registered_country : Self.Country ,
132- represented_country : Self.RepresentedCountry ,
83+ city : Self.City = .{} ,
84+ continent : Self.Continent = .{} ,
85+ country : Self.Country = .{} ,
86+ location : Self.Location = .{} ,
87+ postal : Self.Postal = .{} ,
88+ registered_country : Self.Country = .{} ,
89+ represented_country : Self.RepresentedCountry = .{} ,
13390 subdivisions : ? std .ArrayList (Self .Subdivision ) = null ,
134- traits : Self.Traits ,
135-
136- _arena : std.heap.ArenaAllocator ,
91+ traits : Self.Traits = .{},
13792
13893 const Self = @This ();
13994 pub const City = struct {
@@ -191,27 +146,6 @@ pub const Enterprise = struct {
191146 static_ip_score : f64 = 0 ,
192147 user_type : []const u8 = "" ,
193148 };
194-
195- pub fn init (allocator : std.mem.Allocator ) Self {
196- const arena = std .heap .ArenaAllocator .init (allocator );
197-
198- return .{
199- .city = .{},
200- .continent = .{},
201- .country = .{},
202- .location = .{},
203- .postal = .{},
204- .registered_country = .{},
205- .represented_country = .{},
206- .traits = .{},
207-
208- ._arena = arena ,
209- };
210- }
211-
212- pub fn deinit (self : * const Self ) void {
213- self ._arena .deinit ();
214- }
215149};
216150
217151/// ISP represents a record in the GeoIP2-ISP database, for example,
0 commit comments