我一直在查看文档,到目前为止我还没有看到内置函数来安全地移动项目Vec.
Vec
Vec::get存在,但这只是借用.Vec::remove存在,虽然它确实移出了向量,但如果索引超出范围,它也会发生恐慌.所以,我有两个问题:
Vec::get
Vec::remove
remove(&mut self, index: usize) -> T
remove(&mut self, index: usize) -> Option<T>
rust
rust ×1