Lifetimes
This commit is contained in:
@@ -41,6 +41,7 @@ pub enum TypeExprKind {
|
|||||||
Path(Path),
|
Path(Path),
|
||||||
PathParams(Path, Vec<TypeExpr>),
|
PathParams(Path, Vec<TypeExpr>),
|
||||||
Tuple(Vec<TypeExpr>),
|
Tuple(Vec<TypeExpr>),
|
||||||
|
Lifetime(Identifier),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ impl From<pest::iterators::Pair<'_, Rule>> for TypeExpr {
|
|||||||
TypeExprKind::from(inner.next().unwrap()),
|
TypeExprKind::from(inner.next().unwrap()),
|
||||||
inner.map(TypePostfix::from).collect(),
|
inner.map(TypePostfix::from).collect(),
|
||||||
),
|
),
|
||||||
|
Rule::type_expr_param => TypeExpr::from(inner.next().unwrap()),
|
||||||
|
Rule::lifetime => TypeExpr(
|
||||||
|
TypeExprKind::Lifetime(Identifier::from(inner.next().unwrap())),
|
||||||
|
Vec::new(),
|
||||||
|
),
|
||||||
_ => unimplemented!("{rule:#?}"),
|
_ => unimplemented!("{rule:#?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ impl GetRust for TypeExprKind {
|
|||||||
fn get_rust(&self) -> String {
|
fn get_rust(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
TypeExprKind::Path(path) => get_static_type_path(path),
|
TypeExprKind::Path(path) => get_static_type_path(path),
|
||||||
|
TypeExprKind::Lifetime(name) => format!("'{}", name.get_rust()),
|
||||||
TypeExprKind::PathParams(path, params) => {
|
TypeExprKind::PathParams(path, params) => {
|
||||||
format!(
|
format!(
|
||||||
"{}<{}>",
|
"{}<{}>",
|
||||||
|
|||||||
Reference in New Issue
Block a user