feat: add audio track types
This commit is contained in:
parent
3a75ed8610
commit
86775ea95b
9 changed files with 1480 additions and 399 deletions
|
|
@ -145,40 +145,16 @@ pub async fn generate_locales() {
|
|||
|
||||
//! Languages and countries
|
||||
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::Error;
|
||||
"#;
|
||||
|
||||
let code_foot = r#"impl Display for Language {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(
|
||||
&serde_json::to_string(self).map_or("".to_owned(), |s| s[1..s.len() - 1].to_owned()),
|
||||
)
|
||||
}
|
||||
}
|
||||
let code_foot = r#"serde_plain::derive_fromstr_from_deserialize!(Language, Error);
|
||||
serde_plain::derive_display_from_serialize!(Language);
|
||||
|
||||
impl Display for Country {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(
|
||||
&serde_json::to_string(self).map_or("".to_owned(), |s| s[1..s.len() - 1].to_owned()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Language {
|
||||
type Err = serde_json::Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
serde_json::from_str(&format!("\"{}\"", s))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Country {
|
||||
type Err = serde_json::Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
serde_json::from_str(&format!("\"{}\"", s))
|
||||
}
|
||||
}
|
||||
serde_plain::derive_fromstr_from_deserialize!(Country, Error);
|
||||
serde_plain::derive_display_from_serialize!(Country);
|
||||
"#;
|
||||
|
||||
let mut code_langs = r#"/// Available languages
|
||||
|
|
|
|||
Reference in a new issue