Added static fn type

This commit is contained in:
2026-06-06 23:52:53 +02:00
parent 330beaea75
commit 5e5d22f3c5
2 changed files with 9 additions and 5 deletions
+8 -5
View File
@@ -176,11 +176,6 @@ impl GetRust for Identifier {
impl GetRust for TypeExpr { impl GetRust for TypeExpr {
fn get_rust(&self) -> String { fn get_rust(&self) -> String {
match self { match self {
// TypePostfix::Ref => format!("&"),
// TypePostfix::RefMut => format!("&mut "),
// TypePostfix::RefLifetime(lifetime) => format!("&'{} ", lifetime.get_rust()),
// TypePostfix::RefMutLifetime(lifetime) => format!("&'{} mut ", lifetime.get_rust()),
// TypePostfix::Dyn => format!("dyn "),
Self::Path(path, generics) => { Self::Path(path, generics) => {
if let Some(generics) = generics { if let Some(generics) = generics {
format!("{}{}", get_static_type_path(path), generics.get_rust()) format!("{}{}", get_static_type_path(path), generics.get_rust())
@@ -197,6 +192,14 @@ impl GetRust for TypeExpr {
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(", ") .join(", ")
), ),
Self::StaticFn(types) => format!(
"fn({})",
types
.into_iter()
.map(|t| t.get_rust())
.collect::<Vec<_>>()
.join(", ")
),
Self::Ref { Self::Ref {
lifetime, lifetime,
+1
View File
@@ -26,6 +26,7 @@ pub enum TypeExpr {
}, },
Dyn(Box<TypeExpr>), Dyn(Box<TypeExpr>),
Path(Path, Option<Generics>), Path(Path, Option<Generics>),
StaticFn(Vec<TypeExpr>),
Tuple(Vec<TypeExpr>), Tuple(Vec<TypeExpr>),
Lifetime(Identifier), Lifetime(Identifier),
} }