summaryrefslogtreecommitdiffstats
path: root/src/doc/book/redirects/patterns.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/doc/book/redirects/patterns.md
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/doc/book/redirects/patterns.md')
-rw-r--r--src/doc/book/redirects/patterns.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/doc/book/redirects/patterns.md b/src/doc/book/redirects/patterns.md
new file mode 100644
index 000000000..1936368b2
--- /dev/null
+++ b/src/doc/book/redirects/patterns.md
@@ -0,0 +1,23 @@
+% Patterns
+
+<small>There is a new edition of the book and this is an old link.</small>
+
+> Patterns are a special syntax within Rust for matching against the structure of our types, complex or simple.
+> A pattern is made up of some combination of literals; destructured arrays, enums, structs, or tuples; variables, wildcards, and placeholders.
+> These pieces describe the “shape” of the data we’re working with.
+
+```rust
+let x = Some(5);
+let y = 10;
+
+match x {
+ Some(50) => println!("Got 50"),
+ Some(y) => println!("Matched, y = {:?}", y),
+ _ => println!("Default case, x = {:?}", x),
+}
+```
+
+---
+
+You can find the latest version of this information
+[here](ch06-02-match.html). \ No newline at end of file