blob: 88239315981a397df05f4449b4c70150ef10b777 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! A more natural way to use `not`
//!
//! # Examples
//!
//! ```
//! use nicht::not;
//!
//! assert_eq!(not(true), false);
//! ```
use std::ops::Not;
pub fn not<T: Not>(x: T) -> <T as Not>::Output {
Not::not(x)
}
#[cfg(test)]
mod tests {
use crate::not;
#[test]
fn primitive_data_type() {
assert_eq!(not(true), false);
assert_eq!(not(false), true);
assert_ne!(not(true), true);
assert_ne!(not(false), false);
}
}
|