Primitive Type bool
[-]
[+]
The boolean type
Trait Implementations
impl Not<bool> for bool
impl BitAnd<bool, bool> for bool
impl BitOr<bool, bool> for bool
impl BitXor<bool, bool> for bool
impl PartialEq<bool> for bool
impl Eq for bool
fn assert_receiver_is_total_eq(&self)
impl PartialOrd<bool> for bool
fn partial_cmp(&self, other: &bool) -> Option<Ordering>
fn lt(&self, &bool) -> bool
fn le(&self, &bool) -> bool
fn gt(&self, &bool) -> bool
fn ge(&self, &bool) -> bool
impl Ord for bool
impl Clone for bool
impl Default for bool
impl FromStr for bool
fn from_str(s: &str) -> Option<bool>
Parse a bool
from a string.
Yields an Option<bool>
, because s
may or may not actually be parseable.
Examples
fn main() { assert_eq!("true".parse(), Some(true)); assert_eq!("false".parse(), Some(false)); assert_eq!("not even a boolean".parse::<bool>(), None); }assert_eq!("true".parse(), Some(true)); assert_eq!("false".parse(), Some(false)); assert_eq!("not even a boolean".parse::<bool>(), None);