mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-21 20:21:09 +03:00
fix: compile error when using enum in flutter
This commit is contained in:
26
libs/flutter_rust_bridge_codegen/src/ir/ident.rs
Normal file
26
libs/flutter_rust_bridge_codegen/src/ir/ident.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user