[][src]Function tao_of_rust::ch02::primitives::char_type

pub fn char_type()

基本数据类型:char类型

Basic usage:

fn char_type(){
    let x = 'r';
    let x = 'Ú';
    println!("{}", '\'');
    println!("{}", '\\');
    println!("{}", '\n');
    println!("{}", '\r');
    println!("{}", '\t');
    assert_eq!('\x2A', '*');
    assert_eq!('\x25', '%');
    assert_eq!('\u{CA0}', 'ಠ');
    assert_eq!('\u{151}', 'ő');
    assert_eq!('%' as i8, 37);
    assert_eq!('ಠ' as i8, -96); //该字符值的高位会被截断,最终得到-96
}
char_type();Run