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.
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.
13 #![feature(slice_patterns)]
21 Foo { string: "foo".to_string() }
,
22 Foo { string: "bar".to_string() }
,
23 Foo { string: "baz".to_string() }
26 [ref first
, tail
..] => {
27 assert_eq
!(first
.string
, "foo".to_string());
28 assert_eq
!(tail
.len(), 2);
29 assert_eq
!(tail
[0].string
, "bar".to_string());
30 assert_eq
!(tail
[1].string
, "baz".to_string());
33 [Foo { .. }
, _
, Foo { .. }
, _tail
..] => {
36 [Foo { string: ref a }
, Foo { string: ref b }
] => {
37 assert_eq
!("bar", &a
[0..a
.len()]);
38 assert_eq
!("baz", &b
[0..b
.len()]);