docs: more model documentation

This commit is contained in:
ThetaDev 2022-09-27 16:25:47 +02:00
parent 305c3ee70e
commit 49f3aa3577
7 changed files with 48 additions and 23 deletions

View file

@ -1,8 +1,12 @@
// This file is automatically generated. DO NOT EDIT.
//! Languages and countries
use std::{fmt::Display, str::FromStr};
use serde::{Deserialize, Serialize};
/// Available languages
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(rename_all = "lowercase")]
pub enum Language {
@ -184,6 +188,7 @@ pub enum Language {
Zu,
}
/// Available countries
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(rename_all = "UPPERCASE")]
pub enum Country {
@ -407,6 +412,7 @@ pub enum Country {
Zw,
}
/// Array of all available languages
pub const LANGUAGES: [Language; 83] = [
Language::Af,
Language::Am,
@ -493,6 +499,7 @@ pub const LANGUAGES: [Language; 83] = [
Language::Zu,
];
/// Array of all available countries
pub const COUNTRIES: [Country; 109] = [
Country::Ae,
Country::Ar,
@ -606,6 +613,9 @@ pub const COUNTRIES: [Country; 109] = [
];
impl Language {
/// Get the native name of the language
///
/// Examples: "English (US)", "Deutsch", "中文 (简体)"
pub fn name(&self) -> &str {
match self {
Language::Af => "Afrikaans",
@ -696,6 +706,9 @@ impl Language {
}
impl Country {
/// Get the English name of the country
///
/// Examples: "United States", "Germany"
pub fn name(&self) -> &str {
match self {
Country::Ae => "United Arab Emirates",