pub enum Country {
Show 120 variants
AD,
AL,
AM,
AR,
AT,
AU,
AX,
BA,
BB,
BE,
BG,
BJ,
BO,
BR,
BS,
BW,
BY,
BZ,
CA,
CD,
CG,
CH,
CL,
CN,
CO,
CR,
CU,
CY,
CZ,
DE,
DK,
DO,
EC,
EE,
EG,
ES,
FI,
FO,
FR,
GA,
GB,
GD,
GE,
GG,
GH,
GI,
GL,
GM,
GR,
GT,
GY,
HK,
HN,
HR,
HT,
HU,
ID,
IE,
IM,
IS,
IT,
JE,
JM,
JP,
KE,
KR,
KZ,
LI,
LS,
LT,
LU,
LV,
MA,
MC,
MD,
ME,
MG,
MK,
MN,
MS,
MT,
MX,
MZ,
NA,
NE,
NG,
NI,
NL,
NO,
NZ,
PA,
PE,
PG,
PH,
PL,
PR,
PT,
PY,
RO,
RS,
RU,
SC,
SE,
SG,
SI,
SJ,
SK,
SM,
SR,
SV,
TN,
TR,
UA,
US,
UY,
VA,
VE,
VN,
ZA,
ZW,
}Expand description
An enum for selecting a country.
use opening_hours::localization::Country;
let country: Country = "FR".parse().unwrap();
assert_eq!(country, Country::FR);Variants§
AD
Andorra
AL
Albania
AM
Armenia
AR
Argentina
AT
Austria
AU
Australia
AX
Åland Islands
BA
Bosnia and Herzegovina
BB
Barbados
BE
Belgium
BG
Bulgaria
BJ
Benin
BO
Bolivia
BR
Brazil
BS
Bahamas
BW
Botswana
BY
Belarus
BZ
Belize
CA
Canada
CD
DR Congo
CG
Congo
CH
Switzerland
CL
Chile
CN
China
CO
Colombia
CR
Costa Rica
CU
Cuba
CY
Cyprus
CZ
Czechia
DE
Germany
DK
Denmark
DO
Dominican Republic
EC
Ecuador
EE
Estonia
EG
Egypt
ES
Spain
FI
Finland
FO
Faroe Islands
FR
France
GA
Gabon
GB
United Kingdom
GD
Grenada
GE
Georgia
GG
Guernsey
GH
Ghana
GI
Gibraltar
GL
Greenland
GM
Gambia
GR
Greece
GT
Guatemala
GY
Guyana
HK
Hong Kong
HN
Honduras
HR
Croatia
HT
Haiti
HU
Hungary
ID
Indonesia
IE
Ireland
IM
Isle of Man
IS
Iceland
IT
Italy
JE
Jersey
JM
Jamaica
JP
Japan
KE
Kenya
KR
South Korea
KZ
Kazakhstan
LI
Liechtenstein
LS
Lesotho
LT
Lithuania
LU
Luxembourg
LV
Latvia
MA
Morocco
MC
Monaco
MD
Moldova
ME
Montenegro
MG
Madagascar
MK
North Macedonia
MN
Mongolia
MS
Montserrat
MT
Malta
MX
Mexico
MZ
Mozambique
NA
Namibia
NE
Niger
NG
Nigeria
NI
Nicaragua
NL
Netherlands
NO
Norway
NZ
New Zealand
PA
Panama
PE
Peru
PG
Papua New Guinea
PH
Philippines
PL
Poland
PR
Puerto Rico
PT
Portugal
PY
Paraguay
RO
Romania
RS
Serbia
RU
Russia
SC
Seychelles
SE
Sweden
SG
Singapore
SI
Slovenia
SJ
Svalbard and Jan Mayen
SK
Slovakia
SM
San Marino
SR
Suriname
SV
El Salvador
TN
Tunisia
TR
Türkiye
UA
Ukraine
US
United States
UY
Uruguay
VA
Vatican City
VE
Venezuela
VN
Vietnam
ZA
South Africa
ZW
Zimbabwe
Implementations§
Source§impl Country
impl Country
Source§impl Country
impl Country
Sourcepub fn try_from_coords(coords: Coordinates) -> Option<Self>
Available on crate feature auto-country only.
pub fn try_from_coords(coords: Coordinates) -> Option<Self>
auto-country only.Attempt to automatically detect a country from coordinates.
use opening_hours::localization::{Coordinates, Country};
let coords = Coordinates::new(48.86, 2.34).unwrap();
let country_paris = Country::try_from_coords(coords).unwrap();
assert_eq!(country_paris, Country::FR);Sourcepub fn holidays(self) -> ContextHolidays
pub fn holidays(self) -> ContextHolidays
Load holidays for this country from a compact embedded database.
use chrono::NaiveDate;
use opening_hours::localization::Country;
let holidays_fr = Country::FR.holidays();
let date = NaiveDate::from_ymd_opt(2024, 7, 14).unwrap(); // french national day
assert!(holidays_fr.get_public().contains(date));