src/metaprogramming.rs

branch
dev
changeset 75
e9f4550cfa18
parent 59
9226980e45a7
equal deleted inserted replaced
74:2c76df38d02b 75:e9f4550cfa18
1 /*! 1 /*!
2 Metaprogramming tools 2 Metaprogramming tools
3 */ 3 */
4 4
5 /// Reference `x` if so indicated by the first parameter. 5 /// Reference `x` if so indicated by the first parameter.
6 /// Typically to be used from another macro. See the implementation of 6 /// Typically to be used from another macro.
7 /// [power][crate::vectorspace::powerspace] and [product spaces][crate::vectorspace::productspace].
8 /// 7 ///
9 /// ```ignore 8 /// ```ignore
10 /// maybe_ref!(ref, V) // ➡ &V 9 /// maybe_ref!(ref, V) // ➡ &V
11 /// maybe_ref!(noref, V) // ➡ V 10 /// maybe_ref!(noref, V) // ➡ V
12 /// ``` 11 /// ```
25 (ref, $a:expr, $b:expr) => { $a }; 24 (ref, $a:expr, $b:expr) => { $a };
26 } 25 }
27 26
28 27
29 /// Annotate `x` with a lifetime if the first parameter 28 /// Annotate `x` with a lifetime if the first parameter
30 /// Typically to be used from another macro. See the implementation of 29 /// Typically to be used from another macro.
31 /// [power][crate::vectorspace::powerspace] and [product spaces][crate::vectorspace::productspace].
32 /// 30 ///
33 /// ```ignore 31 /// ```ignore
34 /// maybe_ref!(ref, &'a V) // ➡ &'a V 32 /// maybe_ref!(ref, &'a V) // ➡ &'a V
35 /// maybe_ref!(noref, &'a V) // ➡ V 33 /// maybe_ref!(noref, &'a V) // ➡ V
36 /// ``` 34 /// ```

mercurial