]> git.proxmox.com Git - rustc.git/blobdiff - src/doc/rust-by-example/src/generics/new_types.md
New upstream version 1.53.0+dfsg1
[rustc.git] / src / doc / rust-by-example / src / generics / new_types.md
index ccbbbb03cfc58b72700b8498d83153487020d6da..c819002c289de03d6e88faa699d52f26303dab77 100644 (file)
@@ -40,13 +40,14 @@ fn main() {
 
 Uncomment the last print statement to observe that the type supplied must be `Years`.
 
-To obtain the `newtype`'s value as the base type, you may use tuple syntax like so:
+To obtain the `newtype`'s value as the base type, you may use the tuple or destructuring syntax like so:
 ```rust, editable
 struct Years(i64);
 
 fn main() {
     let years = Years(42);
-    let years_as_primitive: i64 = years.0;
+    let years_as_primitive_1: i64 = years.0; // Tuple
+    let Years(years_as_primitive_2) = years; // Destructuring
 }
 ```