From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/syn/src/print.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 vendor/syn/src/print.rs (limited to 'vendor/syn/src/print.rs') diff --git a/vendor/syn/src/print.rs b/vendor/syn/src/print.rs new file mode 100644 index 0000000..0740993 --- /dev/null +++ b/vendor/syn/src/print.rs @@ -0,0 +1,16 @@ +use proc_macro2::TokenStream; +use quote::ToTokens; + +pub(crate) struct TokensOrDefault<'a, T: 'a>(pub &'a Option); + +impl<'a, T> ToTokens for TokensOrDefault<'a, T> +where + T: ToTokens + Default, +{ + fn to_tokens(&self, tokens: &mut TokenStream) { + match self.0 { + Some(t) => t.to_tokens(tokens), + None => T::default().to_tokens(tokens), + } + } +} -- cgit v1.2.3