1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! The [`alias!`] macro can be used to assign token streams to convenient identifiers.
//!
//! ```
//! use quote::quote;
//! use quote_alias::alias;
//!
//! alias! {
//! Foo(my_crate::Foo),
//! }
//!
//! # fn main() {
//! // same as: quote! { my_crate::Foo::new() };
//! let create_foo = quote! { #Foo::new() };
//! # }
//! ```
//!
//! See [`alias!`] for more detailed documentation and usage examples.
pub use TokenStream;
pub use ;
/// Assigns a token stream to an identifier.
///
/// This is done by generating a unit struct that implements [`ToTokens`].
/// The struct can be then interpolated in [`quote!`] invocations or have its `ToTokens` methods called directly.
///
/// Visibility and doc comments are also passed through to the struct.
///
/// # Usage
/// ```
/// use quote_alias::alias;
/// use quote::quote;
///
/// alias! {
/// /// `Foo` from `my_crate::foo`
/// pub Foo(my_crate::foo::Foo),
///
/// this_and_that {
/// my_crate::this();
/// my_crate::that();
/// },
/// }
///
/// # fn main() {
/// // same as: quote! { my_crate::foo::Foo::new() };
/// quote! { #Foo::new() };
///
/// // same as: quote! {
/// // my_crate::this();
/// // my_crate::that();
/// // };
/// quote! { #this_and_that };
/// # }
/// ```
///
/// [`quote!`]: quote::quote
/// [`ToTokens`]: quote::ToTokens
;
=> ;
}