Builtin type std::prelude::bool
Re-export from std::builtins::bool
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
false
if arguments are equal,true
otherwise -
mixin Comparable<u8>
-
Returns
true
iflhs
is strictly less thanrhs
,false
otherwise -
Returns
true
iflhs
is less or equal torhs
,false
otherwise -
Returns
true
iflhs
strictly greater thanrhs
,false
otherwise -
Returns
true
iflhs
greater than or equalrhs
,false
otherwise