tupleops_macros/
lib.rs

1// Copyright (c) 2021 René Kijewski <rene.[SURNAME]@fu-berlin.de>
2// All rights reserved.
3//
4// This software and the accompanying materials are made available under
5// the terms of the ISC License which is available in the project root as LICENSE-ISC, AND/OR
6// the terms of the MIT License which is available at in the project root as LICENSE-MIT, AND/OR
7// the terms of the Apache License, Version 2.0 which is available in the project root as LICENSE-APACHE.
8//
9// You have to accept AT LEAST one of the aforementioned licenses to use, copy, modify, and/or distribute this software.
10// At your will you may redistribute the software under the terms of only one, two, or all three of the aforementioned licenses.
11
12#![forbid(unsafe_code)]
13
14//! Procedural macros needed to implement [tupleop](https://crates.io/crates/tupleops).
15
16mod common;
17
18use proc_macro::TokenStream;
19
20use common::generate;
21
22macro_rules! implement {
23    () => {};
24
25    ( $name:ident ) => {
26        #[proc_macro]
27        pub fn $name(input: TokenStream) -> TokenStream {
28            generate(input, tupleops_generator::$name)
29        }
30    };
31
32    ( $name:ident $($names:ident)+ ) => {
33        implement! { $name }
34        implement! { $($names)+ }
35    };
36}
37
38implement! {
39    tuple_all_ok
40    tuple_all_some
41    tuple_append
42    tuple_apply
43    tuple_concat_many
44    tuple_concat
45    tuple_length
46    tuple_map
47    tuple_option
48    tuple_prepend
49    tuple_ref_mut
50    tuple_ref
51    tuple_tuple
52    tuple_unappend
53    tuple_unprepend
54}