Primitive Type bool
[-] [+]
Trait Implementations
impl Not for bool
impl<'a> Not for &'a bool
impl BitAnd for bool
impl<'a> BitAnd<bool> for &'a bool
impl<'a> BitAnd<&'a bool> for bool
impl<'a, 'b> BitAnd<&'a bool> for &'b bool
impl BitOr for bool
impl<'a> BitOr<bool> for &'a bool
impl<'a> BitOr<&'a bool> for bool
impl<'a, 'b> BitOr<&'a bool> for &'b bool
impl BitXor for bool
impl<'a> BitXor<bool> for &'a bool
impl<'a> BitXor<&'a bool> for bool
impl<'a, 'b> BitXor<&'a bool> for &'b bool
impl PartialEq for bool
impl Eq for bool
impl PartialOrd for bool
fn partial_cmp(&self, other: &bool) -> Option<Ordering>
fn lt(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
fn gt(&self, other: &Rhs) -> bool
fn ge(&self, other: &Rhs) -> bool
impl Ord for bool
impl Clone for bool
impl Default for bool
impl FromStr for bool
type Err = ParseBoolError
fn from_str(s: &str) -> Result<bool, ParseBoolError>
Parse a bool
from a string.
Yields a Result<bool, ParseBoolError>
, because s
may or may not
actually be parseable.
Examples
fn main() { use std::str::FromStr; assert_eq!(FromStr::from_str("true"), Ok(true)); assert_eq!(FromStr::from_str("false"), Ok(false)); assert!(<bool as FromStr>::from_str("not even a boolean").is_err()); }use std::str::FromStr; assert_eq!(FromStr::from_str("true"), Ok(true)); assert_eq!(FromStr::from_str("false"), Ok(false)); assert!(<bool as FromStr>::from_str("not even a boolean").is_err());
Note, in many cases, the .parse()
method on str
is more proper.
assert_eq!("true".parse(), Ok(true)); assert_eq!("false".parse(), Ok(false)); assert!("not even a boolean".parse::<bool>().is_err());