本文簡要介紹rust語言中 std::collections::BinaryHeap.append
的用法。
用法
pub fn append(&mut self, other: &mut BinaryHeap<T>)
將 other
的所有元素移動到 self
中,將 other
留空。
例子
基本用法:
use std::collections::BinaryHeap;
let v = vec![-10, 1, 2, 3, 3];
let mut a = BinaryHeap::from(v);
let v = vec![-20, 5, 43];
let mut b = BinaryHeap::from(v);
a.append(&mut b);
assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
assert!(b.is_empty());
相關用法
- Rust BinaryHeap.as_slice用法及代碼示例
- Rust BinaryHeap.capacity用法及代碼示例
- Rust BinaryHeap.push用法及代碼示例
- Rust BinaryHeap.clear用法及代碼示例
- Rust BinaryHeap.new用法及代碼示例
- Rust BinaryHeap.retain用法及代碼示例
- Rust BinaryHeap.pop用法及代碼示例
- Rust BinaryHeap.peek_mut用法及代碼示例
- Rust BinaryHeap.reserve_exact用法及代碼示例
- Rust BinaryHeap.peek用法及代碼示例
- Rust BinaryHeap.drain用法及代碼示例
- Rust BinaryHeap.reserve用法及代碼示例
- Rust BinaryHeap.len用法及代碼示例
- Rust BinaryHeap.drain_sorted用法及代碼示例
- Rust BinaryHeap.iter用法及代碼示例
- Rust BinaryHeap.shrink_to_fit用法及代碼示例
- Rust BinaryHeap.into_iter_sorted用法及代碼示例
- Rust BinaryHeap.into_sorted_vec用法及代碼示例
- Rust BinaryHeap.with_capacity用法及代碼示例
- Rust BinaryHeap.into_vec用法及代碼示例
- Rust BinaryHeap.shrink_to用法及代碼示例
- Rust BinaryHeap.is_empty用法及代碼示例
- Rust BinaryHeap用法及代碼示例
- Rust Binary用法及代碼示例
- Rust BitXor用法及代碼示例
注:本文由純淨天空篩選整理自rust-lang.org大神的英文原創作品 std::collections::BinaryHeap.append。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。