rust(32)-类C枚举体

PS F:\learn\rustlearn\learn31> cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
PS F:\learn\rustlearn\learn31> cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target\debug\learn31.exe`
start0
stop1
pause2
PS F:\learn\rustlearn\learn31>
pub enum Status{
   Start=0,
   Stop=1,
   Pause=2,
}
pub fn print_info(now_status:Status)->(){
   	match now_status{
	    Status::Start=> println!("start{}",Status::Start as i32),  
	    Status::Stop=> println!("stop{}",Status::Stop as i32),
	    Status::Pause=> println!("pause{}",Status::Pause as i32), 
	}
}
fn main() {
    let s1=Status::Start;
	let s2=Status::Stop;
	let s3=Status::Pause;	
    print_info(s1);
    print_info(s2);
    print_info(s3);	
}
上一篇:pdfium 解析


下一篇:html5-voideo_DOM