pub fn char_from_str(s: &str) -> Result<char, ParseCharError> {
    match s {
        "#\\newline"   => Ok('\n'),
        "#\\space"     => Ok(' '),
        "#\\return"    => Ok('\r'),
        "#\\tab"       => Ok('\t'),
        "#\\alarm"     => Ok('\x07'),
        "#\\backspace" => Ok('\x08'),
        "#\\delete"    => Ok('\x7f'),
        "#\\escape"    => Ok('\x1b'),
        "#\\null"      => Ok('\0'),
        _ => {
            if s.len() > 3 && s.starts_with("#\\x") {
                match u32::from_str_radix(&s[3..], 16) {
                    Ok(code) => {
                        match char::from_u32(code) {
                            Some(ch) => Ok(ch),
                            None => Err(ParseCharError{ kind: CharErrorKind::InvalidUTF })
                        }
                    },
                    Err(_) => {
                        Err(ParseCharError{ kind: CharErrorKind::InvalidHex })
                    }
                }
            } else if s.len() == 3 {
                Ok(s[2..].chars().next().unwrap())
            } else {
                Err(ParseCharError{ kind: CharErrorKind::Unrecognized })
            }
        }
    }
}
/// `char_from_str` returns a `char` based on the given string input,
/// which must be one of the acceptable Scheme character literals.
`char_from_str` returns a `char` based on the given string input,
which must be one of the acceptable Scheme character literals.
` char_from_str ` returns a ` char ` based on the given string input which must be one of the acceptable Scheme character literals .
pub fn char_from_str(s: &str) -> Result<char, ParseCharError> {
    match s {
        "#\\newline"   => Ok('\n'),
        "#\\space"     => Ok(' '),
        "#\\return"    => Ok('\r'),
        "#\\tab"       => Ok('\t'),
        "#\\alarm"     => Ok('\x07'),
        "#\\backspace" => Ok('\x08'),
        "#\\delete"    => Ok('\x7f'),
        "#\\escape"    => Ok('\x1b'),
        "#\\null"      => Ok('\0'),
        _ => {
            if s.len() > 3 && s.starts_with("#\\x") {
                match u32::from_str_radix(&s[3..], 16) {
                    Ok(code) => {
                        match char::from_u32(code) {
                            Some(ch) => Ok(ch),
                            None => Err(ParseCharError{ kind: CharErrorKind::InvalidUTF })
                        }
                    },
                    Err(_) => {
                        Err(ParseCharError{ kind: CharErrorKind::InvalidHex })
                    }
                }
            } else if s.len() == 3 {
                Ok(s[2..].chars().next().unwrap())
            } else {
                Err(ParseCharError{ kind: CharErrorKind::Unrecognized })
            }
        }
    }
}
pub fn char_from_str ( s : & str ) -> Result < char , ParseCharError > { match s { " \\ " => Ok ( '\n' ) , " \\ " => Ok ( ' ' ) , " \\ " => Ok ( '\r' ) , " \\ " => Ok ( '\t' ) , " \\ " => Ok ( '\x07' ) , " \\ " => Ok ( '\x08' ) , " \\ " => Ok ( '\x7f' ) , " \\ " => Ok ( '\x1b' ) , " \\ " => Ok ( '\0' ) , _ => { if s . len ( ) > 3 && s . starts_with ( " \\ " ) { match u32 :: from_str_radix ( & s [ 3 .. ] , 16 ) { Ok ( code ) => { match char :: from_u32 ( code ) { Some ( ch ) => Ok ( ch ) , None => Err ( ParseCharError { kind : CharErrorKind :: InvalidUTF } ) } } , Err ( _ ) => { Err ( ParseCharError { kind : CharErrorKind :: InvalidHex } ) } } } else if s . len ( ) == 3 { Ok ( s [ 2 .. ] . chars ( ) . next ( ) . unwrap ( ) ) } else { Err ( ParseCharError { kind : CharErrorKind :: Unrecognized } ) } } } }
`char_from_str` returns a `char` based on the given string input,
which must be one of the acceptable Scheme character literals.
` char_from_str ` returns a ` char ` based on the given string input which must be one of the acceptable Scheme character literals .
s
&str