-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
add the bool::not method. #82786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add the bool::not method. #82786
Changes from 3 commits
3db2efb
a25f6f7
828aa80
663ce13
00c5426
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,4 +31,17 @@ impl bool { | |
| pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> { | ||
| if self { Some(f()) } else { None } | ||
| } | ||
|
|
||
| /// Returns the opposite value. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// assert_eq!(false.not(), true); | ||
| /// assert_eq!(true.not(), false); | ||
| /// ``` | ||
| #[unstable(feature = "bool_not_method", issue = "none")] | ||
| pub fn not(self) -> Self { | ||
|
||
| !self | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.