fix: compile error when using enum in flutter

This commit is contained in:
SoLongAndThanksForAllThePizza
2022-05-31 16:28:12 +08:00
parent 00ba7cad81
commit 5825ae4531
59 changed files with 6133 additions and 87 deletions

View File

@@ -0,0 +1,26 @@
use convert_case::{Case, Casing};
#[derive(Debug, Clone)]
pub struct IrIdent {
pub raw: String,
}
impl std::fmt::Display for IrIdent {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
fmt.write_str(&self.raw)
}
}
impl IrIdent {
pub fn new(raw: String) -> IrIdent {
IrIdent { raw }
}
pub fn rust_style(&self) -> &str {
&self.raw
}
pub fn dart_style(&self) -> String {
self.raw.to_case(Case::Camel)
}
}