blueprint_dupe_derive/lib.rs
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is dual-licensed under either the MIT license found in the
5 * LICENSE-MIT file in the root directory of this source tree or the Apache
6 * License, Version 2.0 found in the LICENSE-APACHE file in the root directory
7 * of this source tree. You may select, at your option, one of the
8 * above-listed licenses.
9 */
10
11mod clone;
12mod copy;
13mod dupe;
14mod util;
15
16/// Derive the `Dupe` trait.
17#[proc_macro_derive(Dupe)]
18pub fn derive_dupe(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
19 dupe::derive_dupe(input)
20}
21
22/// Derive the `Dupe` trait, but without requiring all type arguments to implement `Dupe`.
23#[proc_macro_derive(Dupe_)]
24pub fn derive_dupe_(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
25 dupe::derive_dupe_(input)
26}
27
28/// Derive the [`Clone` trait](Clone), but without requiring all type arguments to implement [`Clone`].
29#[proc_macro_derive(Clone_)]
30pub fn derive_clone_(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
31 clone::derive_clone_(input)
32}
33
34/// Derive the [`Copy` trait](Copy), but without requiring all type arguments to implement [`Copy`].
35#[proc_macro_derive(Copy_)]
36pub fn derive_copy_(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
37 copy::derive_copy_(input)
38}