27 lines
507 B
Rust
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)
|
|
}
|
|
}
|