1 | //! The futures-rs procedural macro implementations. |
2 | |
3 | #![doc (test( |
4 | no_crate_inject, |
5 | attr( |
6 | deny(warnings, rust_2018_idioms, single_use_lifetimes), |
7 | allow(dead_code, unused_assignments, unused_variables) |
8 | ) |
9 | ))] |
10 | |
11 | use proc_macro::TokenStream; |
12 | |
13 | mod executor; |
14 | mod join; |
15 | mod select; |
16 | mod stream_select; |
17 | |
18 | /// The `join!` macro. |
19 | #[proc_macro ] |
20 | pub fn join_internal(input: TokenStream) -> TokenStream { |
21 | crate::join::join(input) |
22 | } |
23 | |
24 | /// The `try_join!` macro. |
25 | #[proc_macro ] |
26 | pub fn try_join_internal(input: TokenStream) -> TokenStream { |
27 | crate::join::try_join(input) |
28 | } |
29 | |
30 | /// The `select!` macro. |
31 | #[proc_macro ] |
32 | pub fn select_internal(input: TokenStream) -> TokenStream { |
33 | crate::select::select(input) |
34 | } |
35 | |
36 | /// The `select_biased!` macro. |
37 | #[proc_macro ] |
38 | pub fn select_biased_internal(input: TokenStream) -> TokenStream { |
39 | crate::select::select_biased(input) |
40 | } |
41 | |
42 | // TODO: Change this to doc comment once rustdoc bug fixed: https://github.com/rust-lang/futures-rs/pull/2435 |
43 | // The `test` attribute. |
44 | #[proc_macro_attribute ] |
45 | pub fn test_internal (input: TokenStream, item: TokenStream) -> TokenStream { |
46 | crate::executor::test(args:input, item) |
47 | } |
48 | |
49 | /// The `stream_select!` macro. |
50 | #[proc_macro ] |
51 | pub fn stream_select_internal(input: TokenStream) -> TokenStream { |
52 | crateTokenStream::stream_select::stream_select(input.into()) |
53 | .unwrap_or_else(op:syn::Error::into_compile_error) |
54 | .into() |
55 | } |
56 | |