From 417ad7574167f00746145e1647e6a617accc49cd Mon Sep 17 00:00:00 2001 From: h-h-h-h <13482553+h-h-h-h@users.noreply.github.com> Date: Fri, 18 Nov 2022 02:47:27 +0100 Subject: [PATCH] Update enum.md Distinguish better between enums and enum variants. The first sentence I changed at first confused me, until I understood that its imprecise. --- src/custom_types/enum.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/custom_types/enum.md b/src/custom_types/enum.md index e861df9bfd..b7fb7e419b 100644 --- a/src/custom_types/enum.md +++ b/src/custom_types/enum.md @@ -1,7 +1,7 @@ # Enums The `enum` keyword allows the creation of a type which may be one of a few -different variants. Any variant which is valid as a `struct` is also valid as +different variants. Any variant which is valid as a `struct` is also valid in an `enum`. ```rust,editable @@ -10,7 +10,7 @@ an `enum`. // `PageLoad != PageUnload` and `KeyPress(char) != Paste(String)`. // Each is different and independent. enum WebEvent { - // An `enum` may either be `unit-like`, + // An `enum` variant may either be `unit-like`, PageLoad, PageUnload, // like tuple structs, @@ -26,7 +26,7 @@ fn inspect(event: WebEvent) { match event { WebEvent::PageLoad => println!("page loaded"), WebEvent::PageUnload => println!("page unloaded"), - // Destructure `c` from inside the `enum`. + // Destructure `c` from inside the `enum` variant. WebEvent::KeyPress(c) => println!("pressed '{}'.", c), WebEvent::Paste(s) => println!("pasted \"{}\".", s), // Destructure `Click` into `x` and `y`.