Files
rustdesk/libs/flutter_rust_bridge_codegen/src/ir/ident.rs
2022-05-31 16:28:12 +08:00

27 lines
507 B
Rust

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)
}
}