Commit 14e7872
Refactor GeoIP2 structs for ergonomic access
Replace BTreeMap-based names with typed Names struct using Option<&str>
fields for each language. Make nested struct fields non-optional with
Default, while keeping leaf values as Option<T> to preserve semantics.
This eliminates nested Option unwrapping:
- Old: city.city.as_ref().and_then(|c| c.names.english)
- New: city.city.names.english
Add is_empty() methods using *self == Self::default() pattern so they
don't need updating when fields are added.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 8707834 commit 14e7872
File tree
6 files changed
+373
-181
lines changed- examples
- src
6 files changed
+373
-181
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
71 | 87 | | |
72 | 88 | | |
73 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
| |||
0 commit comments