Added static fn type
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user