diff options
Diffstat (limited to 'vendor/time-macros/src/to_tokens.rs')
-rw-r--r-- | vendor/time-macros/src/to_tokens.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/time-macros/src/to_tokens.rs b/vendor/time-macros/src/to_tokens.rs index 3a293925c..7e7321153 100644 --- a/vendor/time-macros/src/to_tokens.rs +++ b/vendor/time-macros/src/to_tokens.rs @@ -1,3 +1,5 @@ +use std::num::NonZeroU16; + use proc_macro::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree}; pub(crate) trait ToTokenStream: Sized { @@ -39,6 +41,14 @@ impl ToTokenTree for &str { } } +impl ToTokenTree for NonZeroU16 { + fn into_token_tree(self) -> TokenTree { + quote_group! {{ + unsafe { ::core::num::NonZeroU16::new_unchecked(#(self.get())) } + }} + } +} + macro_rules! impl_for_tree_types { ($($type:ty)*) => {$( impl ToTokenTree for $type { |