PS F:\learn\rustlearn> rustc learn26.rs PS F:\learn\rustlearn> ./learn26.exe 精通rust: 6 69.09
精通rust: 6 69.09
PS F:\learn\rustlearn>
pub fn print_book(book:(&'static str,i32,f64))->(){
println!("{}: {} {}",book.0,book.1,book.2);
let (name,count,price)=book;
println!("{}: {} {}",name,count,price);
}
fn main(){
let book1:(&'static str,i32,f64)=("精通rust",6,69.09);
print_book(book1);
}
来源:CSDN
作者:AI_LX
链接:https://blog.csdn.net/AI_LX/article/details/104736473