We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d464a4 commit 6591ca2Copy full SHA for 6591ca2
README.md
@@ -18,3 +18,4 @@ in a controlled repository now.
18
* `modules`: example of modules
19
* `point.rs`: example of "methods" and ownership
20
* `units.rs`: example of newtype and deriving
21
+* `patmove.rs`: example of `ref` in patterns
patmove.rs
@@ -0,0 +1,18 @@
1
+struct Foo {
2
+ tuple: (String, u64),
3
+}
4
+
5
+impl Foo {
6
+ fn is_hello(&self) -> bool {
7
+ match self.tuple {
8
+ (ref s, _) => {
9
+ s == "hello"
10
+ }
11
12
13
14
15
+fn main() {
16
+ let t = Foo { tuple: ("hello".to_string(), 1) };
17
+ println!("{}", t.is_hello());
0 commit comments