Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
EqualMa committed Apr 25, 2024
1 parent 3a213bb commit 77aef42
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/frender-macro-core/src/rsx/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ pub enum RsxChild {
Element(RsxElement),
}

pub type OptionalCratePathAndRsxChild = crate::utils::prefix_path::PrefixPath<RsxChild>;
pub struct OptionalCratePathAndRsxChild(pub(super) crate::utils::prefix_path::PrefixPath<RsxChild>);
6 changes: 6 additions & 0 deletions crates/frender-macro-core/src/rsx/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,9 @@ impl Parse for RsxChild {
}
}
}

impl Parse for OptionalCratePathAndRsxChild {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
Parse::parse(input).map(Self)
}
}
6 changes: 6 additions & 0 deletions crates/frender-macro-core/src/rsx/to_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,9 @@ impl RsxChild {
}
}
}

impl OptionalCratePathAndRsxChild {
pub fn into_ts(self) -> proc_macro2::TokenStream {
self.0.map(RsxChild::into_ts)
}
}
2 changes: 1 addition & 1 deletion crates/frender-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ pub fn rsx(input: TokenStream) -> TokenStream {
}
};

value.map(rsx::RsxChild::into_ts).into()
value.into_ts().into()
}

0 comments on commit 77aef42

Please sign in to comment.