Rust中的Vector类型

mac2022-06-30  20

常用类型操作,

如python中的list,turple,dictory等,

更方常编程常用数据的处理。

fn main() { let v = vec![1, 2, 3, 4, 5]; let third: &i32 = &v[2]; println!("The third element is {}", third); match v.get(2) { Some(third) => println!("The element is {}", third), None => println!("There is no element"), } match v.get(20) { Some(twenty) => println!("The element is {}", twenty), None => println!("There is no element"), } }

转载于:https://www.cnblogs.com/aguncn/p/11405307.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)