1use std::borrow::Cow;
4
5use crate::query::AsApiStr;
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
9#[non_exhaustive]
10pub enum TemperatureUnit {
11 Celsius,
13 Fahrenheit,
15}
16
17impl AsApiStr for TemperatureUnit {
18 fn as_api_str(&self) -> Cow<'static, str> {
19 Cow::Borrowed(match self {
20 Self::Celsius => "celsius",
21 Self::Fahrenheit => "fahrenheit",
22 })
23 }
24}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
28#[non_exhaustive]
29pub enum WindSpeedUnit {
30 Kmh,
32 Ms,
34 Mph,
36 Kn,
38}
39
40impl AsApiStr for WindSpeedUnit {
41 fn as_api_str(&self) -> Cow<'static, str> {
42 Cow::Borrowed(match self {
43 Self::Kmh => "kmh",
44 Self::Ms => "ms",
45 Self::Mph => "mph",
46 Self::Kn => "kn",
47 })
48 }
49}
50
51#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
53#[non_exhaustive]
54pub enum LengthUnit {
55 Metric,
57 Imperial,
59}
60
61impl AsApiStr for LengthUnit {
62 fn as_api_str(&self) -> Cow<'static, str> {
63 Cow::Borrowed(match self {
64 Self::Metric => "metric",
65 Self::Imperial => "imperial",
66 })
67 }
68}
69
70#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
72#[non_exhaustive]
73pub enum PrecipitationUnit {
74 Mm,
76 Inch,
78}
79
80impl AsApiStr for PrecipitationUnit {
81 fn as_api_str(&self) -> Cow<'static, str> {
82 Cow::Borrowed(match self {
83 Self::Mm => "mm",
84 Self::Inch => "inch",
85 })
86 }
87}
88
89#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
91#[non_exhaustive]
92pub enum TimeFormat {
93 Iso8601,
95 UnixTime,
97}
98
99impl AsApiStr for TimeFormat {
100 fn as_api_str(&self) -> Cow<'static, str> {
101 Cow::Borrowed(match self {
102 Self::Iso8601 => "iso8601",
103 Self::UnixTime => "unixtime",
104 })
105 }
106}
107
108#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize)]
110#[non_exhaustive]
111pub enum Timezone {
112 Auto,
114 Gmt,
116 Iana(String),
118}
119
120impl AsApiStr for Timezone {
121 fn as_api_str(&self) -> Cow<'static, str> {
122 match self {
123 Self::Auto => Cow::Borrowed("auto"),
124 Self::Gmt => Cow::Borrowed("GMT"),
125 Self::Iana(value) => Cow::Owned(value.clone()),
126 }
127 }
128}
129
130#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize)]
132#[non_exhaustive]
133pub enum CellSelection {
134 Land,
136 Sea,
138 Nearest,
140}
141
142impl AsApiStr for CellSelection {
143 fn as_api_str(&self) -> Cow<'static, str> {
144 Cow::Borrowed(match self {
145 Self::Land => "land",
146 Self::Sea => "sea",
147 Self::Nearest => "nearest",
148 })
149 }
150}