countires/
types.rs

1// Auto generated file, please do not modify
2
3/// Day
4#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
5#[cfg_attr(
6    all(feature = "async-graphql", feature = "alloc"),
7    derive(::async_graphql::Enum)
8)]
9#[repr(u8)]
10pub enum Day {
11    /// Sunday
12    Sunday,
13    /// Monday
14    Monday,
15    /// Tuesday
16    Tuesday,
17    /// Wednesday
18    Wednesday,
19    /// Thursday
20    Thursday,
21    /// Friday
22    Friday,
23    /// Saturday
24    Saturday,
25}
26
27impl core::fmt::Display for Day {
28    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
29        match self {
30            Day::Sunday => write!(f, "Sunday"),
31            Day::Monday => write!(f, "Monday"),
32            Day::Tuesday => write!(f, "Tuesday"),
33            Day::Wednesday => write!(f, "Wednesday"),
34            Day::Thursday => write!(f, "Thursday"),
35            Day::Friday => write!(f, "Friday"),
36            Day::Saturday => write!(f, "Saturday"),
37        }
38    }
39}
40
41#[cfg(feature = "serde")]
42impl serde::Serialize for Day {
43    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
44    where
45        S: serde::Serializer,
46    {
47        match self {
48            Day::Sunday => serializer.serialize_str("Sunday"),
49            Day::Monday => serializer.serialize_str("Monday"),
50            Day::Tuesday => serializer.serialize_str("Tuesday"),
51            Day::Wednesday => serializer.serialize_str("Wednesday"),
52            Day::Thursday => serializer.serialize_str("Thursday"),
53            Day::Friday => serializer.serialize_str("Friday"),
54            Day::Saturday => serializer.serialize_str("Saturday"),
55        }
56    }
57}
58
59#[cfg(feature = "serde")]
60impl<'de> serde::Deserialize<'de> for Day {
61    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
62    where
63        D: serde::Deserializer<'de>,
64    {
65        let s = <&'de str as serde::Deserialize<'de>>::deserialize(deserializer)?;
66        match s {
67            "sunday" | "Sunday" | "Sun" | "sun" => Ok(Self::Sunday),
68            "monday" | "Monday" | "Mon" | "mon" => Ok(Self::Monday),
69            "tuesday" | "Tuesday" | "Tue" | "tue" => Ok(Self::Tuesday),
70            "wednesday" | "Wednesday" | "Wed" | "wed" => Ok(Self::Wednesday),
71            "thursday" | "Thursday" | "Thu" | "thu" => Ok(Self::Thursday),
72            "friday" | "Friday" | "Fri" | "fri" => Ok(Self::Friday),
73            "saturday" | "Saturday" | "Sat" | "sat" => Ok(Self::Saturday),
74            _ => Err(serde::de::Error::custom(format!("Unknown day: {}", s))),
75        }
76    }
77}
78
79impl Day {
80    /// Returns short name of the day
81    #[inline]
82    pub const fn short(&self) -> &'static str {
83        match self {
84            Day::Sunday => "Sun",
85            Day::Monday => "Mon",
86            Day::Tuesday => "Tue",
87            Day::Wednesday => "Wed",
88            Day::Thursday => "Thu",
89            Day::Friday => "Fri",
90            Day::Saturday => "Sat",
91        }
92    }
93
94    #[inline]
95    pub const fn as_str(&self) -> &'static str {
96        match self {
97            Day::Sunday => "Sunday",
98            Day::Monday => "Monday",
99            Day::Tuesday => "Tuesday",
100            Day::Wednesday => "Wednesday",
101            Day::Thursday => "Thursday",
102            Day::Friday => "Friday",
103            Day::Saturday => "Saturday",
104        }
105    }
106}
107
108/// Type of clock used
109#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
110#[cfg_attr(
111    all(feature = "async-graphql", feature = "alloc"),
112    derive(::async_graphql::Enum)
113)]
114#[repr(u8)]
115pub enum HourClock {
116    /// 12-hour clock
117    Twelve,
118    /// 24-hour clock
119    TwentyFour,
120    /// Mixed (12-hour clock or 24-hour clock)
121    Mixed,
122}
123
124impl core::fmt::Display for HourClock {
125    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
126        match self {
127            HourClock::Twelve => write!(f, "12hr"),
128            HourClock::TwentyFour => write!(f, "24hr"),
129            HourClock::Mixed => write!(f, "mixed"),
130        }
131    }
132}
133
134#[cfg(feature = "serde")]
135impl serde::Serialize for HourClock {
136    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
137    where
138        S: serde::Serializer,
139    {
140        match self {
141            HourClock::Twelve => serializer.serialize_str("12hr"),
142            HourClock::TwentyFour => serializer.serialize_str("24hr"),
143            HourClock::Mixed => serializer.serialize_str("mixed"),
144        }
145    }
146}
147
148#[cfg(feature = "serde")]
149impl<'de> serde::Deserialize<'de> for HourClock {
150    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
151    where
152        D: serde::Deserializer<'de>,
153    {
154        <&'de str as serde::Deserialize<'de>>::deserialize(deserializer).and_then(|s| match s {
155            "12hr" | "12" => Ok(HourClock::Twelve),
156            "24hr" | "24" => Ok(HourClock::TwentyFour),
157            "Mixed" | "mixed" | "12hr/24hr" | "24hr/12hr" | "12/24" | "24/12" | "12 or 24"
158            | "12hr or 24hr" | "24hr or 12hr" | "24 or 12" => Ok(HourClock::Mixed),
159            _ => Err(serde::de::Error::custom(format!(
160                "Unknown hour clock: {}",
161                s
162            ))),
163        })
164    }
165}
166
167/// Driving side
168#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
169#[cfg_attr(
170    all(feature = "async-graphql", feature = "alloc"),
171    derive(::async_graphql::Enum)
172)]
173#[repr(u8)]
174pub enum DrivingSide {
175    /// Left-hand side
176    Left,
177    /// Right-hand side
178    Right,
179}
180
181impl core::fmt::Display for DrivingSide {
182    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
183        match self {
184            DrivingSide::Left => write!(f, "left"),
185            DrivingSide::Right => write!(f, "right"),
186        }
187    }
188}
189
190#[cfg(feature = "serde")]
191impl serde::Serialize for DrivingSide {
192    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
193    where
194        S: serde::Serializer,
195    {
196        match self {
197            DrivingSide::Left => serializer.serialize_str("left"),
198            DrivingSide::Right => serializer.serialize_str("right"),
199        }
200    }
201}
202
203#[cfg(feature = "serde")]
204impl<'de> serde::Deserialize<'de> for DrivingSide {
205    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
206    where
207        D: serde::Deserializer<'de>,
208    {
209        <&'de str as serde::Deserialize<'de>>::deserialize(deserializer).and_then(|s| match s {
210            "left" | "Left" | "l" | "L" => Ok(DrivingSide::Left),
211            "right" | "Right" | "r" | "R" => Ok(DrivingSide::Right),
212            _ => Err(serde::de::Error::custom(format!(
213                "Unknown driving side: {}",
214                s
215            ))),
216        })
217    }
218}
219
220/// The unit of distance used (kilometer or mile)
221#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
222#[cfg_attr(
223    all(feature = "async-graphql", feature = "alloc"),
224    derive(::async_graphql::Enum)
225)]
226#[repr(u8)]
227pub enum DistanceUint {
228    /// Kilometer
229    Kilometer,
230    /// Mile
231    Mile,
232}
233
234impl core::fmt::Display for DistanceUint {
235    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
236        match self {
237            DistanceUint::Kilometer => write!(f, "kilometer"),
238            DistanceUint::Mile => write!(f, "mile"),
239        }
240    }
241}
242
243#[cfg(feature = "serde")]
244impl serde::Serialize for DistanceUint {
245    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
246    where
247        S: serde::Serializer,
248    {
249        match self {
250            DistanceUint::Kilometer => serializer.serialize_str("kilometer"),
251            DistanceUint::Mile => serializer.serialize_str("mile"),
252        }
253    }
254}
255
256#[cfg(feature = "serde")]
257impl<'de> serde::Deserialize<'de> for DistanceUint {
258    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
259    where
260        D: serde::Deserializer<'de>,
261    {
262        <&'de str as serde::Deserialize<'de>>::deserialize(deserializer).and_then(|s| match s {
263            "kilometer" | "km" | "Kilometer" | "Km" | "KM" => Ok(DistanceUint::Kilometer),
264            "mile" | "mi" | "Mile" | "Mi" | "MI" => Ok(DistanceUint::Mile),
265            _ => Err(serde::de::Error::custom(format!(
266                "Unknown distance unit: {}",
267                s
268            ))),
269        })
270    }
271}
272
273/// The unit of temperature (celsius or fahrenheit)
274#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
275#[cfg_attr(
276    all(feature = "async-graphql", feature = "alloc"),
277    derive(::async_graphql::Enum)
278)]
279#[repr(u8)]
280pub enum TemperatureUint {
281    /// Celsius
282    Celsius,
283    /// Fahrenheit
284    Fahrenheit,
285    /// Mixed,
286    Mixed,
287}
288
289impl core::fmt::Display for TemperatureUint {
290    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
291        match self {
292            TemperatureUint::Celsius => write!(f, "celsius"),
293            TemperatureUint::Fahrenheit => write!(f, "fahrenheit"),
294            TemperatureUint::Mixed => write!(f, "mixed"),
295        }
296    }
297}
298
299#[cfg(feature = "serde")]
300impl serde::Serialize for TemperatureUint {
301    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
302    where
303        S: serde::Serializer,
304    {
305        match self {
306            TemperatureUint::Celsius => serializer.serialize_str("celsius"),
307            TemperatureUint::Fahrenheit => serializer.serialize_str("fahrenheit"),
308            TemperatureUint::Mixed => serializer.serialize_str("mixed"),
309        }
310    }
311}
312
313#[cfg(feature = "serde")]
314impl<'de> serde::Deserialize<'de> for TemperatureUint {
315    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
316    where
317        D: serde::Deserializer<'de>,
318    {
319        <&'de str as serde::Deserialize<'de>>::deserialize(deserializer).and_then(|s| match s {
320            "celsius" | "Celsius" => Ok(TemperatureUint::Celsius),
321            "fahrenheit" | "Fahrenheit" => Ok(TemperatureUint::Fahrenheit),
322            "mixed"
323            | "Mixed"
324            | "celsius or fahrenheit"
325            | "Celsius or Fahrenheit"
326            | "celsius/fahrenheit"
327            | "Celsius/Fahrenheit"
328            | " fahrenheit or celsius"
329            | "Fahrenheit or Celsius"
330            | "fahrenheit/celsius"
331            | "Fahrenheit/Celsius" => Ok(TemperatureUint::Mixed),
332            _ => Err(serde::de::Error::custom(format!(
333                "Unknown temperature unit: {}",
334                s
335            ))),
336        })
337    }
338}
339
340/// The system of measurement in use
341#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
342#[cfg_attr(
343    all(feature = "async-graphql", feature = "alloc"),
344    derive(::async_graphql::Enum)
345)]
346#[repr(u8)]
347pub enum MeasurementSystem {
348    /// Metric system
349    Metric,
350    /// Imperial system
351    Imperial,
352}
353
354impl core::fmt::Display for MeasurementSystem {
355    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
356        match self {
357            MeasurementSystem::Metric => write!(f, "metric"),
358            MeasurementSystem::Imperial => write!(f, "imperial"),
359        }
360    }
361}
362
363#[cfg(feature = "serde")]
364impl serde::Serialize for MeasurementSystem {
365    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
366    where
367        S: serde::Serializer,
368    {
369        match self {
370            MeasurementSystem::Metric => serializer.serialize_str("metric"),
371            MeasurementSystem::Imperial => serializer.serialize_str("imperial"),
372        }
373    }
374}
375
376#[cfg(feature = "serde")]
377impl<'de> serde::Deserialize<'de> for MeasurementSystem {
378    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
379    where
380        D: serde::Deserializer<'de>,
381    {
382        let s = <&'de str as serde::Deserialize<'de>>::deserialize(deserializer)?;
383        match s {
384            "metric" | "Metric" => Ok(MeasurementSystem::Metric),
385            "imperial" | "Imperial" => Ok(MeasurementSystem::Imperial),
386            _ => Err(serde::de::Error::custom(format!(
387                "Unknown measurement system: {}",
388                s
389            ))),
390        }
391    }
392}
393
394#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
395#[cfg_attr(
396    all(feature = "async-graphql", feature = "alloc"),
397    derive(::async_graphql::Enum)
398)]
399#[repr(u8)]
400pub enum TimezoneType {
401    Link,
402    Canonical,
403}
404
405impl core::fmt::Display for TimezoneType {
406    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
407        match self {
408            TimezoneType::Link => write!(f, "link"),
409            TimezoneType::Canonical => write!(f, "canonical"),
410        }
411    }
412}
413
414#[cfg(feature = "serde")]
415impl serde::Serialize for TimezoneType {
416    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
417    where
418        S: serde::Serializer,
419    {
420        match self {
421            TimezoneType::Link => serializer.serialize_str("link"),
422            TimezoneType::Canonical => serializer.serialize_str("canonical"),
423        }
424    }
425}
426
427#[cfg(feature = "serde")]
428impl<'de> serde::Deserialize<'de> for TimezoneType {
429    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
430    where
431        D: serde::Deserializer<'de>,
432    {
433        <&'de str as serde::Deserialize<'de>>::deserialize(deserializer).and_then(|s| match s {
434            "link" | "Link" => Ok(TimezoneType::Link),
435            "canonical" | "Canonical" => Ok(TimezoneType::Canonical),
436            _ => Err(serde::de::Error::custom(format!(
437                "Unknown timezone type: {}",
438                s
439            ))),
440        })
441    }
442}
443
444/// Timezone info, reference: [tz database timezones].
445///
446/// [tz database timezones]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
447#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
448#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
449pub struct Timezone {
450    pub(crate) name: &'static str,
451    pub(crate) ty: TimezoneType,
452    pub(crate) linked_to: Option<&'static str>,
453    pub(crate) utc_offset: &'static str,
454    pub(crate) dst_offset: &'static str,
455}
456
457impl Timezone {
458    /// Returns the name of the timezone
459    #[inline]
460    pub const fn name(&self) -> &'static str {
461        self.name
462    }
463
464    /// Returns the type of timezone (primary or alias)
465    #[inline]
466    pub const fn timezone_type(&self) -> TimezoneType {
467        self.ty
468    }
469
470    /// Returns the name of the timezone this timezone is linked to
471    #[inline]
472    pub const fn linked_to(&self) -> Option<&'static str> {
473        self.linked_to
474    }
475
476    /// Returns the UTC offset of the timezone
477    #[inline]
478    pub const fn utc_offset(&self) -> &'static str {
479        self.utc_offset
480    }
481
482    /// Returns the DST offset of the timezone
483    #[inline]
484    pub const fn dst_offset(&self) -> &'static str {
485        self.dst_offset
486    }
487}
488
489#[cfg(all(feature = "async-graphql", feature = "alloc"))]
490mod timezone_graphql {
491    use super::*;
492    use async_graphql::Object;
493
494    #[Object]
495    impl Timezone {
496        /// Returns the name of the timezone
497        #[graphql(name = "name")]
498        #[inline]
499        pub async fn graphql_name(&self) -> &'static str {
500            self.name
501        }
502
503        /// Returns the type of timezone (primary or alias)
504        #[graphql(name = "timezone_type")]
505        #[inline]
506        pub async fn graphql_timezone_type(&self) -> TimezoneType {
507            self.ty
508        }
509
510        /// Returns the name of the timezone this timezone is linked to
511        #[graphql(name = "linked_to")]
512        #[inline]
513        pub async fn graphql_linked_to(&self) -> Option<&'static str> {
514            self.linked_to
515        }
516
517        /// Returns the UTC offset of the timezone
518        #[graphql(name = "utc_offset")]
519        #[inline]
520        pub async fn graphql_utc_offset(&self) -> &'static str {
521            self.utc_offset
522        }
523
524        /// Returns the DST offset of the timezone
525        #[graphql(name = "dst_offset")]
526        #[inline]
527        pub async fn graphql_dst_offset(&self) -> &'static str {
528            self.dst_offset
529        }
530    }
531}
532
533/// Locale
534#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
535#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
536pub struct Locale {
537    pub(crate) ietf: &'static [&'static str],
538    pub(crate) timezones: &'static [&'static Timezone],
539    pub(crate) date_formats: &'static crate::StaticMap<&'static str, &'static str>,
540    pub(crate) measurement_system: MeasurementSystem,
541    pub(crate) hour_clock: HourClock,
542    pub(crate) driving_side: DrivingSide,
543    pub(crate) distance_unit: DistanceUint,
544    pub(crate) temperature_unit: TemperatureUint,
545    pub(crate) week_start_on: Day,
546}
547
548impl Locale {
549    /// Returns the IETF locale code (e.g. `en-US`)
550    #[inline]
551    pub const fn ietf(&self) -> &'static [&'static str] {
552        self.ietf
553    }
554
555    /// Returns the list of [tz database timezones]
556    ///
557    /// [tz database timezones]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
558    #[inline]
559    pub const fn timezones(&self) -> &'static [&'static Timezone] {
560        self.timezones
561    }
562
563    /// Returns date formats for each IETF locale.
564    ///
565    /// - Key is the IETF code
566    /// - Value is the date format, where:
567    ///   - `G` = era
568    ///   - `y` = year
569    ///   - `M` = month
570    ///   - `d` = day
571    #[inline]
572    pub const fn date_formats(&self) -> &'static crate::StaticMap<&'static str, &'static str> {
573        self.date_formats
574    }
575
576    /// Returns system of measurement in use. see [`MeasurementSystem`]
577    #[inline]
578    pub const fn measurement_system(&self) -> MeasurementSystem {
579        self.measurement_system
580    }
581
582    /// Returns the type of clock used. see [`HourClock`]
583    #[inline]
584    pub const fn hour_clock(&self) -> HourClock {
585        self.hour_clock
586    }
587
588    /// Returns the side of the road traffic drives on. see [`DrivingSide`]
589    #[inline]
590    pub const fn driving_side(&self) -> DrivingSide {
591        self.driving_side
592    }
593
594    /// Returns the unit of distance used (kilometer or mile). see [`DistanceUint`]
595    #[inline]
596    pub const fn distance_unit(&self) -> DistanceUint {
597        self.distance_unit
598    }
599
600    /// Returns the unit of temperature (celsius or fahrenheit). see [`TemperatureUint`]
601    #[inline]
602    pub const fn temperature_unit(&self) -> TemperatureUint {
603        self.temperature_unit
604    }
605
606    /// Returns which day is the first day of the week on the calendar. see [`Day`]
607    #[inline]
608    pub const fn week_start_on(&self) -> Day {
609        self.week_start_on
610    }
611}
612
613#[cfg(all(feature = "async-graphql", feature = "alloc"))]
614mod locale_graphql {
615    use super::*;
616    use async_graphql::Object;
617
618    #[Object]
619    impl Locale {
620        /// Returns the IETF locale code (e.g. `en-US`)
621        #[graphql(name = "ietf")]
622        #[inline]
623        pub async fn graphql_ietf(&self) -> &'static [&'static str] {
624            self.ietf
625        }
626
627        /// Returns the list of [tz database timezones]
628        ///
629        /// [tz database timezones]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
630        #[graphql(name = "timezones")]
631        #[inline]
632        pub async fn graphql_timezones(&self) -> &'static [&'static Timezone] {
633            self.timezones
634        }
635
636        /// Returns date formats for each IETF locale.
637        ///
638        /// - Key is the IETF code
639        /// - Value is the date format, where:
640        ///   - `G` = era
641        ///   - `y` = year
642        ///   - `M` = month
643        ///   - `d` = day
644        #[graphql(name = "date_formats")]
645        #[inline]
646        pub async fn graphql_date_formats(
647            &self,
648        ) -> &'static crate::StaticMap<&'static str, &'static str> {
649            self.date_formats
650        }
651
652        /// Returns system of measurement in use. see [`MeasurementSystem`]
653        #[graphql(name = "measurement_system")]
654        #[inline]
655        pub async fn graphql_measurement_system(&self) -> MeasurementSystem {
656            self.measurement_system
657        }
658
659        /// Returns the type of clock used. see [`HourClock`]
660        #[graphql(name = "hour_clock")]
661        #[inline]
662        pub async fn graphql_hour_clock(&self) -> HourClock {
663            self.hour_clock
664        }
665
666        /// Returns the side of the road traffic drives on. see [`DrivingSide`]
667        #[graphql(name = "driving_side")]
668        #[inline]
669        pub async fn graphql_driving_side(&self) -> DrivingSide {
670            self.driving_side
671        }
672
673        /// Returns the unit of distance used (kilometer or mile). see [`DistanceUint`]
674        #[graphql(name = "distance_unit")]
675        #[inline]
676        pub async fn graphql_distance_unit(&self) -> DistanceUint {
677            self.distance_unit
678        }
679
680        /// Returns the unit of temperature (celsius or fahrenheit). see [`TemperatureUint`]
681        #[graphql(name = "temperature_unit")]
682        #[inline]
683        pub async fn graphql_temperature_unit(&self) -> TemperatureUint {
684            self.temperature_unit
685        }
686
687        /// Returns which day is the first day of the week on the calendar. see [`Day`]
688        #[graphql(name = "week_start_on")]
689        #[inline]
690        pub async fn graphql_week_start_on(&self) -> Day {
691            self.week_start_on
692        }
693    }
694}
695
696/// [International dialing direct] info.
697///
698/// [International dialing direct]: https://en.wikipedia.org/wiki/List_of_country_calling_codes
699#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
700#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
701pub struct IDD {
702    pub(crate) prefix: &'static str,
703    pub(crate) suffixes: &'static [&'static str],
704}
705
706impl IDD {
707    /// Returns the geographical code prefix (e.g. +1 for US)
708    #[inline]
709    pub const fn prefix(&self) -> &'static str {
710        self.prefix
711    }
712
713    /// Returns the list of suffixes assigned (e.g. 201 in US)
714    #[inline]
715    pub const fn suffixes(&self) -> &'static [&'static str] {
716        self.suffixes
717    }
718}
719
720#[cfg(all(feature = "async-graphql", feature = "alloc"))]
721mod idd_graphql {
722    use super::*;
723    use async_graphql::Object;
724
725    #[Object]
726    impl IDD {
727        /// Returns the geographical code prefix (e.g. +1 for US)
728        #[graphql(name = "prefix")]
729        #[inline]
730        pub async fn graphql_prefix(&self) -> &'static str {
731            self.prefix
732        }
733
734        /// Returns the list of suffixes assigned (e.g. 201 in US)
735        #[graphql(name = "suffixes")]
736        #[inline]
737        pub async fn graphql_suffixes(&self) -> &'static [&'static str] {
738            self.suffixes
739        }
740    }
741}
742
743#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
744#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
745pub struct Geography {
746    pub(crate) latitude: f64,
747    pub(crate) longitude: f64,
748    pub(crate) land_locked: bool,
749    pub(crate) capital: &'static [&'static str],
750    pub(crate) area: f64,
751    pub(crate) region: &'static str,
752    pub(crate) subregion: &'static str,
753    pub(crate) border_countries: &'static [crate::CCA3],
754}
755
756impl Geography {
757    /// Returns the latitude
758    #[inline]
759    pub const fn latitude(&self) -> f64 {
760        self.latitude
761    }
762
763    /// Returns the longitude
764    #[inline]
765    pub const fn longitude(&self) -> f64 {
766        self.longitude
767    }
768
769    /// Returns whether or not the country is landlocked (not bordering the ocean)
770    #[inline]
771    pub const fn is_landlocked(&self) -> bool {
772        self.land_locked
773    }
774
775    /// Returns the name of the capital cities
776    #[inline]
777    pub const fn capitals(&self) -> &'static [&'static str] {
778        self.capital
779    }
780
781    /// Returns the land area of the country
782    #[inline]
783    pub const fn area(&self) -> f64 {
784        self.area
785    }
786
787    /// Returns the region of the country
788    #[inline]
789    pub const fn region(&self) -> &'static str {
790        self.region
791    }
792
793    /// Returns the subregion of the country
794    #[inline]
795    pub const fn subregion(&self) -> &'static str {
796        self.subregion
797    }
798
799    /// Returns list of countries by their [ISO 3166-1 alpha-3] codes that border the country
800    ///
801    /// [ISO 3166-1 alpha-3]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
802    #[inline]
803    pub const fn border_countries(&self) -> &'static [crate::CCA3] {
804        self.border_countries
805    }
806}
807
808#[cfg(all(feature = "async-graphql", feature = "alloc"))]
809mod geography_graphql {
810    use super::*;
811    use async_graphql::Object;
812
813    #[Object]
814    impl Geography {
815        /// Returns the latitude
816        #[graphql(name = "latitude")]
817        #[inline]
818        pub async fn graphql_latitude(&self) -> f64 {
819            self.latitude
820        }
821
822        /// Returns the longitude
823        #[graphql(name = "longitude")]
824        #[inline]
825        pub async fn graphql_longitude(&self) -> f64 {
826            self.longitude
827        }
828
829        /// Returns whether or not the country is landlocked (not bordering the ocean)
830        #[graphql(name = "is_landlocked")]
831        #[inline]
832        pub async fn graphql_is_landlocked(&self) -> bool {
833            self.land_locked
834        }
835
836        /// Returns the name of the capital cities
837        #[graphql(name = "capitals")]
838        #[inline]
839        pub async fn graphql_capitals(&self) -> &'static [&'static str] {
840            self.capital
841        }
842
843        /// Returns the land area of the country
844        #[graphql(name = "area")]
845        #[inline]
846        pub async fn graphql_area(&self) -> f64 {
847            self.area
848        }
849
850        /// Returns the region of the country
851        #[graphql(name = "region")]
852        #[inline]
853        pub async fn graphql_region(&self) -> &'static str {
854            self.region
855        }
856
857        /// Returns the subregion of the country
858        #[graphql(name = "subregion")]
859        #[inline]
860        pub async fn graphql_subregion(&self) -> &'static str {
861            self.subregion
862        }
863
864        /// Returns list of countries by their [ISO 3166-1 alpha-3] codes that border the country
865        ///
866        /// [ISO 3166-1 alpha-3]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
867        #[graphql(name = "border_countries")]
868        #[inline]
869        pub async fn graphql_border_countries(&self) -> &'static [crate::CCA3] {
870            self.border_countries
871        }
872    }
873}
874
875#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
876#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
877pub struct Currency {
878    pub(crate) name: &'static str,
879    pub(crate) short_name: Option<&'static str>,
880    pub(crate) iso_4217: &'static str,
881    pub(crate) iso_numeric: Option<&'static str>,
882    pub(crate) symbol: &'static str,
883    pub(crate) subunit: Option<&'static str>,
884    pub(crate) prefix: Option<&'static str>,
885    pub(crate) suffix: Option<&'static str>,
886    pub(crate) decimal_mark: Option<char>,
887    pub(crate) decimal_places: u8,
888    pub(crate) thousands_separator: Option<char>,
889}
890
891impl Currency {
892    /// Returns the name of the currency
893    #[inline]
894    pub const fn name(&self) -> &'static str {
895        self.name
896    }
897
898    /// Returns the short name of the currency
899    #[inline]
900    pub const fn short_name(&self) -> Option<&'static str> {
901        self.short_name
902    }
903
904    /// Returns the [ISO 4217] currency code
905    ///
906    /// [ISO 4217]: https://en.wikipedia.org/wiki/ISO_4217
907    #[inline]
908    pub const fn iso4217(&self) -> &'static str {
909        self.iso_4217
910    }
911
912    /// Returns the [ISO 4217 numeric] currency code
913    ///
914    /// [ISO 4217 numeric]: https://en.wikipedia.org/wiki/ISO_4217#cite_note-ISO4217-1
915    #[inline]
916    pub const fn iso_numeric(&self) -> Option<&'static str> {
917        self.iso_numeric
918    }
919
920    /// Returns the currency symbol
921    #[inline]
922    pub const fn symbol(&self) -> &'static str {
923        self.symbol
924    }
925
926    /// Returns the name of the subunit of the currency
927    #[inline]
928    pub const fn subunit(&self) -> Option<&'static str> {
929        self.subunit
930    }
931
932    /// Returns the prefix of the currency symbol
933    #[inline]
934    pub const fn prefix(&self) -> Option<&'static str> {
935        self.prefix
936    }
937
938    /// Returns the suffix of the currency symbol
939    #[inline]
940    pub const fn suffix(&self) -> Option<&'static str> {
941        self.suffix
942    }
943
944    /// Returns the decimal mark of the currency
945    #[inline]
946    pub const fn decimal_mark(&self) -> Option<char> {
947        self.decimal_mark
948    }
949
950    /// Returns the number of decimal places of the currency
951    #[inline]
952    pub const fn decimal_places(&self) -> u8 {
953        self.decimal_places
954    }
955
956    /// Returns the thousands separator of the currency
957    #[inline]
958    pub const fn thousands_separator(&self) -> Option<char> {
959        self.thousands_separator
960    }
961}
962
963#[cfg(all(feature = "async-graphql", feature = "alloc"))]
964mod currency_graphql {
965    use super::*;
966    use async_graphql::Object;
967
968    #[Object]
969    impl Currency {
970        /// Returns the name of the currency
971        #[graphql(name = "name")]
972        #[inline]
973        pub async fn graphql_name(&self) -> &'static str {
974            self.name
975        }
976
977        /// Returns the short name of the currency
978        #[graphql(name = "short_name")]
979        #[inline]
980        pub async fn graphql_short_name(&self) -> Option<&'static str> {
981            self.short_name
982        }
983
984        /// Returns the [ISO 4217] currency code
985        ///
986        /// [ISO 4217]: https://en.wikipedia.org/wiki/ISO_4217
987        #[graphql(name = "iso4217")]
988        #[inline]
989        pub async fn graphql_iso4217(&self) -> &'static str {
990            self.iso_4217
991        }
992
993        /// Returns the [ISO 4217 numeric] currency code
994        ///
995        /// [ISO 4217 numeric]: https://en.wikipedia.org/wiki/ISO_4217#cite_note-ISO4217-1
996        #[graphql(name = "iso_numeric")]
997        #[inline]
998        pub async fn graphql_iso_numeric(&self) -> Option<&'static str> {
999            self.iso_numeric
1000        }
1001
1002        /// Returns the currency symbol
1003        #[graphql(name = "symbol")]
1004        #[inline]
1005        pub async fn graphql_symbol(&self) -> &'static str {
1006            self.symbol
1007        }
1008
1009        /// Returns the name of the subunit of the currency
1010        #[graphql(name = "subunit")]
1011        #[inline]
1012        pub async fn graphql_subunit(&self) -> Option<&'static str> {
1013            self.subunit
1014        }
1015
1016        /// Returns the prefix of the currency symbol
1017        #[graphql(name = "prefix")]
1018        #[inline]
1019        pub async fn graphql_prefix(&self) -> Option<&'static str> {
1020            self.prefix
1021        }
1022
1023        /// Returns the suffix of the currency symbol
1024        #[graphql(name = "suffix")]
1025        #[inline]
1026        pub async fn graphql_suffix(&self) -> Option<&'static str> {
1027            self.suffix
1028        }
1029
1030        /// Returns the decimal mark of the currency
1031        #[graphql(name = "decimal_mark")]
1032        #[inline]
1033        pub async fn graphql_decimal_mark(&self) -> Option<char> {
1034            self.decimal_mark
1035        }
1036
1037        /// Returns the number of decimal places of the currency
1038        #[graphql(name = "decimal_places")]
1039        #[inline]
1040        pub async fn graphql_decimal_places(&self) -> u8 {
1041            self.decimal_places
1042        }
1043
1044        /// Returns the thousands separator of the currency
1045        #[graphql(name = "thousands_separator")]
1046        #[inline]
1047        pub async fn graphql_thousands_separator(&self) -> Option<char> {
1048            self.thousands_separator
1049        }
1050    }
1051}
1052
1053#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1054#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
1055pub struct SubdivisionMeta {
1056    pub(crate) official: &'static str,
1057    pub(crate) common: Option<&'static str>,
1058    pub(crate) native: Option<&'static str>,
1059}
1060
1061impl SubdivisionMeta {
1062    /// Returns the official name of the subdivision
1063    #[inline]
1064    pub const fn official(&self) -> &'static str {
1065        self.official
1066    }
1067
1068    /// Returns the common name of the subdivision
1069    #[inline]
1070    pub const fn common(&self) -> Option<&'static str> {
1071        self.common
1072    }
1073
1074    /// Returns the native name of the subdivision
1075    #[inline]
1076    pub const fn native(&self) -> Option<&'static str> {
1077        self.native
1078    }
1079}
1080
1081#[cfg(all(feature = "async-graphql", feature = "alloc"))]
1082mod subdivision_meta_graphql {
1083    use super::*;
1084    use async_graphql::Object;
1085
1086    #[Object]
1087    impl SubdivisionMeta {
1088        /// Returns the official name of the subdivision
1089        #[graphql(name = "official")]
1090        #[inline]
1091        pub async fn graphql_official(&self) -> &'static str {
1092            self.official
1093        }
1094
1095        /// Returns the common name of the subdivision
1096        #[graphql(name = "common")]
1097        #[inline]
1098        pub async fn graphql_common(&self) -> Option<&'static str> {
1099            self.common
1100        }
1101
1102        /// Returns the native name of the subdivision
1103        #[graphql(name = "native")]
1104        #[inline]
1105        pub async fn graphql_native(&self) -> Option<&'static str> {
1106            self.native
1107        }
1108    }
1109}
1110
1111#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1112#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
1113pub struct Subdivision {
1114    pub(crate) iso: &'static str,
1115    pub(crate) ty: Option<&'static str>,
1116    pub(crate) meta: &'static crate::StaticMap<&'static str, &'static SubdivisionMeta>,
1117}
1118
1119impl Subdivision {
1120    /// Returns the [ISO 3166-2 code] of the subdivision
1121    ///
1122    /// [ISO 3166-2]: https://en.wikipedia.org/wiki/ISO_3166-2
1123    #[inline]
1124    pub const fn iso_code(&self) -> &'static str {
1125        self.iso
1126    }
1127
1128    /// Returns the type of the subdivision
1129    #[inline]
1130    pub const fn subdivision_type(&self) -> Option<&'static str> {
1131        self.ty
1132    }
1133
1134    /// Returns the meta of the subdivision
1135    #[inline]
1136    pub const fn meta(&self) -> &'static crate::StaticMap<&'static str, &'static SubdivisionMeta> {
1137        self.meta
1138    }
1139}
1140
1141#[cfg(all(feature = "async-graphql", feature = "alloc"))]
1142mod subdivision_graphql {
1143    use super::*;
1144    use async_graphql::Object;
1145
1146    #[Object]
1147    impl Subdivision {
1148        /// Returns the [ISO 3166-2 code] of the subdivision
1149        ///
1150        /// [ISO 3166-2]: https://en.wikipedia.org/wiki/ISO_3166-2
1151        #[graphql(name = "iso_code")]
1152        #[inline]
1153        pub async fn graphql_iso_code(&self) -> &'static str {
1154            self.iso
1155        }
1156
1157        /// Returns the type of the subdivision
1158        #[graphql(name = "subdivision_type")]
1159        #[inline]
1160        pub async fn graphql_subdivision_type(&self) -> Option<&'static str> {
1161            self.ty
1162        }
1163
1164        /// Returns the meta of the subdivision
1165        #[graphql(name = "meta")]
1166        #[inline]
1167        pub async fn graphql_meta(
1168            &self,
1169        ) -> &'static crate::StaticMap<&'static str, &'static SubdivisionMeta> {
1170            self.meta
1171        }
1172    }
1173}
1174
1175#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1176#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
1177pub struct Language {
1178    pub(crate) name: &'static str,
1179    pub(crate) native_name: Option<&'static str>,
1180    pub(crate) iso_639_3: &'static str,
1181    pub(crate) bcp_47: &'static str,
1182    pub(crate) iso_15924: &'static str,
1183    pub(crate) iana: &'static [&'static str],
1184    pub(crate) extinct: bool,
1185    pub(crate) spurious: bool,
1186}
1187
1188impl Language {
1189    /// Returns the name of the language
1190    #[inline]
1191    pub const fn name(&self) -> &'static str {
1192        self.name
1193    }
1194
1195    /// Returns the native name of the language
1196    #[inline]
1197    pub const fn native_name(&self) -> Option<&'static str> {
1198        self.native_name
1199    }
1200
1201    /// Returns the [ISO 639-3] language code.
1202    ///
1203    /// [ISO 639-3]: https://en.wikipedia.org/wiki/ISO_639-3
1204    #[inline]
1205    pub const fn iso639_3(&self) -> &'static str {
1206        self.iso_639_3
1207    }
1208
1209    /// Returns the [BCP 47] tag.
1210    ///
1211    /// [BCP 47]: https://en.wikipedia.org/wiki/IETF_language_tag
1212    #[inline]
1213    pub const fn bcp47(&self) -> &'static str {
1214        self.bcp_47
1215    }
1216
1217    /// Returns the [ISO 15924] script code.
1218    ///
1219    /// [ISO 15924]: https://en.wikipedia.org/wiki/ISO_15924
1220    #[inline]
1221    pub const fn iso15924(&self) -> &'static str {
1222        self.iso_15924
1223    }
1224
1225    /// Returns array of assigned [IANA] tags.
1226    ///
1227    /// [IANA]: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
1228    // TODO: add IANA struct which contains the information, and replace str with that struct
1229    #[inline]
1230    pub const fn iana(&self) -> &'static [&'static str] {
1231        self.iana
1232    }
1233
1234    /// Returns whether the language is extinct
1235    #[inline]
1236    pub const fn is_extinct(&self) -> bool {
1237        self.extinct
1238    }
1239
1240    /// Returns whether the language is spurious
1241    #[inline]
1242    pub const fn is_spurious(&self) -> bool {
1243        self.spurious
1244    }
1245}
1246
1247#[cfg(all(feature = "async-graphql", feature = "alloc"))]
1248mod language_graphql {
1249    use super::*;
1250    use async_graphql::Object;
1251
1252    #[Object]
1253    impl Language {
1254        /// Returns the name of the language
1255        #[graphql(name = "name")]
1256        #[inline]
1257        pub async fn graphql_name(&self) -> &'static str {
1258            self.name
1259        }
1260
1261        /// Returns the native name of the language
1262        #[graphql(name = "native_name")]
1263        #[inline]
1264        pub async fn graphql_native_name(&self) -> Option<&'static str> {
1265            self.native_name
1266        }
1267
1268        /// Returns the [ISO 639-3] language code.
1269        ///
1270        /// [ISO 639-3]: https://en.wikipedia.org/wiki/ISO_639-3
1271        #[graphql(name = "iso639_3")]
1272        #[inline]
1273        pub async fn graphql_iso639_3(&self) -> &'static str {
1274            self.iso_639_3
1275        }
1276
1277        /// Returns the [BCP 47] tag.
1278        ///
1279        /// [BCP 47]: https://en.wikipedia.org/wiki/IETF_language_tag
1280        #[graphql(name = "bcp47")]
1281        #[inline]
1282        pub async fn graphql_bcp47(&self) -> &'static str {
1283            self.bcp_47
1284        }
1285
1286        /// Returns the [ISO 15924] script code.
1287        ///
1288        /// [ISO 15924]: https://en.wikipedia.org/wiki/ISO_15924
1289        #[graphql(name = "iso15924")]
1290        #[inline]
1291        pub async fn graphql_iso15924(&self) -> &'static str {
1292            self.iso_15924
1293        }
1294
1295        /// Returns array of assigned [IANA] tags.
1296        ///
1297        /// [IANA]: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
1298        // TODO: add IANA struct which contains the information, and replace str with that struct
1299        #[graphql(name = "iana")]
1300        #[inline]
1301        pub async fn graphql_iana(&self) -> &'static [&'static str] {
1302            self.iana
1303        }
1304
1305        /// Returns whether the language is extinct
1306        #[graphql(name = "is_extinct")]
1307        #[inline]
1308        pub async fn graphql_is_extinct(&self) -> bool {
1309            self.extinct
1310        }
1311
1312        /// Returns whether the language is spurious
1313        #[graphql(name = "is_spurious")]
1314        #[inline]
1315        pub async fn graphql_is_spurious(&self) -> bool {
1316            self.spurious
1317        }
1318    }
1319}
1320
1321#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1322#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
1323pub struct CountryName {
1324    pub(crate) common: &'static str,
1325    pub(crate) official: &'static str,
1326}
1327
1328impl CountryName {
1329    /// Returns the common name of the country
1330    #[inline]
1331    pub const fn common(&self) -> &'static str {
1332        self.common
1333    }
1334
1335    /// Returns the official name of the country
1336    #[inline]
1337    pub const fn official(&self) -> &'static str {
1338        self.official
1339    }
1340}
1341
1342#[cfg(all(feature = "async-graphql", feature = "alloc"))]
1343mod country_name_graphql {
1344    use super::*;
1345    use async_graphql::Object;
1346
1347    #[Object]
1348    impl CountryName {
1349        /// Returns the common name of the country
1350        #[graphql(name = "common")]
1351        #[inline]
1352        pub async fn graphql_common(&self) -> &'static str {
1353            self.common
1354        }
1355
1356        /// Returns the official name of the country
1357        #[graphql(name = "official")]
1358        #[inline]
1359        pub async fn graphql_official(&self) -> &'static str {
1360            self.official
1361        }
1362    }
1363}
1364
1365#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1366#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
1367pub struct CountryMeta {
1368    pub(crate) common: &'static str,
1369    pub(crate) official: &'static str,
1370    pub(crate) native: &'static crate::StaticMap<&'static str, &'static CountryName>,
1371    pub(crate) alternates: &'static [&'static str],
1372}
1373
1374impl CountryMeta {
1375    /// Returns the common name of the country
1376    #[inline]
1377    pub const fn common(&self) -> &'static str {
1378        self.common
1379    }
1380
1381    /// Returns the official name of the country
1382    #[inline]
1383    pub const fn official(&self) -> &'static str {
1384        self.official
1385    }
1386
1387    /// Returns the name of the country in native languages
1388    #[inline]
1389    pub const fn native(&self) -> &'static crate::StaticMap<&'static str, &'static CountryName> {
1390        self.native
1391    }
1392
1393    /// Returns the alternate names of the country
1394    #[inline]
1395    pub const fn alternates(&self) -> &'static [&'static str] {
1396        self.alternates
1397    }
1398}
1399
1400#[cfg(all(feature = "async-graphql", feature = "alloc"))]
1401mod country_meta_graphql {
1402    use super::*;
1403    use async_graphql::Object;
1404
1405    #[Object]
1406    impl CountryMeta {
1407        /// Returns the common name of the country
1408        #[graphql(name = "common")]
1409        #[inline]
1410        pub async fn graphql_common(&self) -> &'static str {
1411            self.common
1412        }
1413
1414        /// Returns the official name of the country
1415        #[graphql(name = "official")]
1416        #[inline]
1417        pub async fn graphql_official(&self) -> &'static str {
1418            self.official
1419        }
1420
1421        /// Returns the name of the country in native languages
1422        #[graphql(name = "native")]
1423        #[inline]
1424        pub async fn graphql_native(
1425            &self,
1426        ) -> &'static crate::StaticMap<&'static str, &'static CountryName> {
1427            self.native
1428        }
1429
1430        /// Returns the alternate names of the country
1431        #[graphql(name = "alternates")]
1432        #[inline]
1433        pub async fn graphql_alternates(&self) -> &'static [&'static str] {
1434            self.alternates
1435        }
1436    }
1437}
1438
1439#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
1440#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
1441pub struct Country {
1442    pub(crate) name: &'static CountryMeta,
1443    pub(crate) flag: &'static str,
1444    pub(crate) cca2: &'static str,
1445    pub(crate) cca3: &'static str,
1446    pub(crate) ccn3: &'static str,
1447    pub(crate) ioc: Option<&'static str>,
1448    pub(crate) tld: &'static [&'static str],
1449    pub(crate) locale: &'static Locale,
1450    pub(crate) idd: &'static IDD,
1451    pub(crate) geography: &'static Geography,
1452    pub(crate) official_languages: &'static [&'static Language],
1453    pub(crate) spoken_languages: &'static [&'static str],
1454    pub(crate) currencies: &'static [&'static Currency],
1455    pub(crate) subdivisions: &'static [&'static Subdivision],
1456}
1457
1458impl Country {
1459    /// Returns the name metadata of the country
1460    #[inline]
1461    pub const fn name(&self) -> &'static CountryMeta {
1462        self.name
1463    }
1464
1465    /// Returns the country's flag
1466    #[inline]
1467    pub const fn flag(&self) -> &'static str {
1468        self.flag
1469    }
1470
1471    /// Returns [ISO 3166-1 alpha-2] code.
1472    ///
1473    /// [ISO 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
1474    #[inline]
1475    pub const fn cca2(&self) -> &'static str {
1476        self.cca2
1477    }
1478
1479    /// Returns [ISO 3166-1 alpha-3] code.
1480    ///
1481    /// [ISO 3166-1 alpha-3]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
1482    #[inline]
1483    pub const fn cca3(&self) -> &'static str {
1484        self.cca3
1485    }
1486
1487    /// Returns [ISO 3166-1 numeric] code.
1488    ///
1489    /// [ISO 3166-1 numeric]: https://en.wikipedia.org/wiki/ISO_3166-1_numeric
1490    #[inline]
1491    pub const fn ccn3(&self) -> &'static str {
1492        self.ccn3
1493    }
1494
1495    /// Returns [International Olympic Committee] code.
1496    ///
1497    /// [International Olympic Committee]: https://en.wikipedia.org/wiki/International_Olympic_Committee
1498    #[inline]
1499    pub const fn ioc(&self) -> Option<&'static str> {
1500        self.ioc
1501    }
1502
1503    /// Returns list of [Country Code Top Level Domain (ccTLD)] used
1504    ///
1505    /// [Country Code Top Level Domain (ccTLD)]: https://en.wikipedia.org/wiki/Country_code_top-level_domain#Lists
1506    #[inline]
1507    pub const fn tld(&self) -> &'static [&'static str] {
1508        self.tld
1509    }
1510
1511    /// Returns the country's locale information
1512    #[inline]
1513    pub const fn locale(&self) -> &'static Locale {
1514        self.locale
1515    }
1516
1517    /// Returns the country's [international dialing direct] information
1518    ///
1519    /// [international dialing direct]: https://en.wikipedia.org/wiki/List_of_country_calling_codes
1520    #[inline]
1521    pub const fn idd(&self) -> &'static IDD {
1522        self.idd
1523    }
1524
1525    /// Returns the country's geographical information
1526    #[inline]
1527    pub const fn geography(&self) -> &'static Geography {
1528        self.geography
1529    }
1530
1531    /// Returns the country's official languages information
1532    #[inline]
1533    pub const fn official_languages(&self) -> &'static [&'static Language] {
1534        self.official_languages
1535    }
1536
1537    /// Returns the country's spoken language codes
1538    #[inline]
1539    pub const fn spoken_languages(&self) -> &'static [&'static str] {
1540        self.spoken_languages
1541    }
1542
1543    /// Returns the list of currencies used in the country
1544    #[inline]
1545    pub const fn currencies(&self) -> &'static [&'static Currency] {
1546        self.currencies
1547    }
1548
1549    /// Returns the subdivisions (states, provinces, etc.) map whose key is [ISO 639-3] in the country
1550    ///
1551    /// [ISO 639-3]: https://en.wikipedia.org/wiki/ISO_639-3
1552    #[inline]
1553    pub const fn subdivisions(&self) -> &'static [&'static Subdivision] {
1554        self.subdivisions
1555    }
1556}
1557
1558#[cfg(all(feature = "async-graphql", feature = "alloc"))]
1559mod country_graphql {
1560    use super::*;
1561    use async_graphql::Object;
1562
1563    #[Object]
1564    impl Country {
1565        /// Returns the name metadata of the country
1566        #[graphql(name = "name")]
1567        #[inline]
1568        pub async fn graphql_name(&self) -> &'static CountryMeta {
1569            self.name
1570        }
1571
1572        /// Returns the country's flag
1573        #[graphql(name = "flag")]
1574        #[inline]
1575        pub async fn graphql_flag(&self) -> &'static str {
1576            self.flag
1577        }
1578
1579        /// Returns [ISO 3166-1 alpha-2] code.
1580        ///
1581        /// [ISO 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
1582        #[graphql(name = "cca2")]
1583        #[inline]
1584        pub async fn graphql_cca2(&self) -> &'static str {
1585            self.cca2
1586        }
1587
1588        /// Returns [ISO 3166-1 alpha-3] code.
1589        ///
1590        /// [ISO 3166-1 alpha-3]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
1591        #[graphql(name = "cca3")]
1592        #[inline]
1593        pub async fn graphql_cca3(&self) -> &'static str {
1594            self.cca3
1595        }
1596
1597        /// Returns [ISO 3166-1 numeric] code.
1598        ///
1599        /// [ISO 3166-1 numeric]: https://en.wikipedia.org/wiki/ISO_3166-1_numeric
1600        #[graphql(name = "ccn3")]
1601        #[inline]
1602        pub async fn graphql_ccn3(&self) -> &'static str {
1603            self.ccn3
1604        }
1605
1606        /// Returns [International Olympic Committee] code.
1607        ///
1608        /// [International Olympic Committee]: https://en.wikipedia.org/wiki/International_Olympic_Committee
1609        #[graphql(name = "ioc")]
1610        #[inline]
1611        pub async fn graphql_ioc(&self) -> Option<&'static str> {
1612            self.ioc
1613        }
1614
1615        /// Returns list of [Country Code Top Level Domain (ccTLD)] used
1616        ///
1617        /// [Country Code Top Level Domain (ccTLD)]: https://en.wikipedia.org/wiki/Country_code_top-level_domain#Lists
1618        #[graphql(name = "tld")]
1619        #[inline]
1620        pub async fn graphql_tld(&self) -> &'static [&'static str] {
1621            self.tld
1622        }
1623
1624        /// Returns the country's locale information
1625        #[graphql(name = "locale")]
1626        #[inline]
1627        pub async fn graphql_locale(&self) -> &'static Locale {
1628            self.locale
1629        }
1630
1631        /// Returns the country's [international dialing direct] information
1632        ///
1633        /// [international dialing direct]: https://en.wikipedia.org/wiki/List_of_country_calling_codes
1634        #[graphql(name = "idd")]
1635        #[inline]
1636        pub async fn graphql_idd(&self) -> &'static IDD {
1637            self.idd
1638        }
1639
1640        /// Returns the country's geographical information
1641        #[graphql(name = "geography")]
1642        #[inline]
1643        pub async fn graphql_geography(&self) -> &'static Geography {
1644            self.geography
1645        }
1646
1647        /// Returns the country's official languages information
1648        #[graphql(name = "official_languages")]
1649        #[inline]
1650        pub async fn graphql_official_languages(&self) -> &'static [&'static Language] {
1651            self.official_languages
1652        }
1653
1654        /// Returns the country's spoken language codes
1655        #[graphql(name = "spoken_languages")]
1656        #[inline]
1657        pub async fn graphql_spoken_languages(&self) -> &'static [&'static str] {
1658            self.spoken_languages
1659        }
1660
1661        /// Returns the list of currencies used in the country
1662        #[graphql(name = "currencies")]
1663        #[inline]
1664        pub async fn graphql_currencies(&self) -> &'static [&'static Currency] {
1665            self.currencies
1666        }
1667
1668        /// Returns the subdivisions (states, provinces, etc.) map whose key is [ISO 639-3] in the country
1669        ///
1670        /// [ISO 639-3]: https://en.wikipedia.org/wiki/ISO_639-3
1671        #[graphql(name = "subdivisions")]
1672        #[inline]
1673        pub async fn graphql_subdivisions(&self) -> &'static [&'static Subdivision] {
1674            self.subdivisions
1675        }
1676    }
1677}