lifetime_proc_macros/
lib.rs

1#![forbid(unsafe_code)]
2
3use proc_macro::TokenStream;
4use syn::{parse_macro_input, DeriveInput};
5
6/// Derive macro generating an impl of the trait `IntoStatic`.
7#[proc_macro_derive(IntoStatic)]
8pub fn derive_into_static(input: TokenStream) -> TokenStream {
9    lifetime_proc_macros_impl::into_static::derive(parse_macro_input!(input as DeriveInput)).into()
10}
11
12/// Derive macro generating an impl of the trait `ToBorrowed`.
13#[proc_macro_derive(ToBorrowed)]
14pub fn derive_to_borrowed(input: TokenStream) -> TokenStream {
15    lifetime_proc_macros_impl::to_borrowed::derive(parse_macro_input!(input as DeriveInput)).into()
16}