From c09c6fc97c1d553dd348383eb98fc7a4788030cb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 30 Jan 2019 23:58:52 +0300 Subject: start tt convertions boilerplate --- crates/ra_hir/src/macros/tt.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/macros') diff --git a/crates/ra_hir/src/macros/tt.rs b/crates/ra_hir/src/macros/tt.rs index 817cb262e..11b1089d3 100644 --- a/crates/ra_hir/src/macros/tt.rs +++ b/crates/ra_hir/src/macros/tt.rs @@ -4,16 +4,18 @@ pub(crate) enum TokenTree { Leaf(Leaf), Subtree(Subtree), } +impl_froms!(TokenTree: Leaf, Subtree); pub(crate) enum Leaf { Literal(Literal), Punct(Punct), Ident(Ident), } +impl_froms!(Leaf: Literal, Punct, Ident); pub(crate) struct Subtree { - delimiter: Delimiter, - token_trees: Vec, + pub(crate) delimiter: Delimiter, + pub(crate) token_trees: Vec, } pub(crate) enum Delimiter { @@ -24,13 +26,13 @@ pub(crate) enum Delimiter { } pub(crate) struct Literal { - text: SmolStr, + pub(crate) text: SmolStr, } pub(crate) struct Punct { - char: char, + pub(crate) char: char, } pub(crate) struct Ident { - text: SmolStr, + pub(crate) text: SmolStr, } -- cgit v1.2.3