toasty_core/macros.rs
1/// Constructs a [`stmt::Path`](crate::stmt::Path) from a dot-separated
2/// sequence of field step expressions.
3///
4/// Each argument is an expression that implements `Into<PathStep>`. The macro
5/// collects them into a `Path` via `FromIterator`.
6///
7/// # Examples
8///
9/// ```ignore
10/// use toasty_core::path;
11/// use toasty_core::stmt::Path;
12///
13/// let p: Path = path![.0 .1];
14/// assert_eq!(p.projection.len(), 2);
15/// ```
16#[macro_export]
17macro_rules! path {
18 (
19 $( . $field:expr )+
20 ) => {
21 [ $( $field, )+ ].into_iter().collect::<$crate::stmt::Path>()
22 };
23}