Boolean type
Methods
impl bool { ... }
-
fn max_value() -> bool
Returns
true. -
fn min_value() -> bool
Returns
false. -
Convert boolean into an Option with a given value.
Returns
Option::some(value)if the boolean istrue,Option::none()otherwise.Example
let o1 = true.then_some("hello"); let o2 = false.then_some("world"); assert_eq!(o1, Option::some("hello")); assert_eq!(o2, Option::none());Run this example -
Convert boolean into an Option with a value provided by a closure.
Returns
Option::some(func())if the boolean istrue,Option::none()otherwise.Example
let o1 = true.then(|| -> &[u8] { "hello" }); let o2 = false.then(|| -> &[u8] { "hello" }); assert_eq!(o1, Option::some("hello")); assert_eq!(o2, Option::none());Run this example
Mixins
impl bool { ... }
-
-
Returns
falseif arguments are equal,trueotherwise -
mixin Comparable<u8>
-
Returns
trueiflhsis strictly less thanrhs,falseotherwise -
Returns
trueiflhsis less or equal torhs,falseotherwise -
Returns
trueiflhsstrictly greater thanrhs,falseotherwise -
Returns
trueiflhsgreater than or equalrhs,falseotherwise