]> git.lizzy.rs Git - rust.git/blob - src/libcollections/macros.rs
collections: Move push/pop to MutableSeq
[rust.git] / src / libcollections / macros.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![macro_escape]
12
13 /// Create a `std::vec::Vec` containing the arguments.
14 #[cfg(not(test))]
15 macro_rules! vec(
16     ($($e:expr),*) => ({
17         #[allow(unused_imports)]
18         use std::collections::MutableSeq;
19
20         // leading _ to allow empty construction without a warning.
21         let mut _temp = ::vec::Vec::new();
22         $(_temp.push($e);)*
23         _temp
24     });
25     ($($e:expr),+,) => (vec!($($e),+))
26 )
27
28 #[cfg(test)]
29 macro_rules! vec(
30     ($($e:expr),*) => ({
31         #[allow(unused_imports)]
32         use MutableSeq;
33
34         // leading _ to allow empty construction without a warning.
35         let mut _temp = ::vec::Vec::new();
36         $(_temp.push($e);)*
37         _temp
38     });
39     ($($e:expr),+,) => (vec!($($e),+))
40 )