aboutsummaryrefslogtreecommitdiff
path: root/src/send.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-22 13:48:43 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-22 13:48:43 +0200
commit50358b944ae7ee4b4aa292ede8bc5d185c86df65 (patch)
treeaaca17843db5f44770d6ff308c45d8321274c70b /src/send.rs
parentaa1b29d41a680f9ae266ed4bdecec89db58226c1 (diff)
downloadnetapp-50358b944ae7ee4b4aa292ede8bc5d185c86df65.tar.gz
netapp-50358b944ae7ee4b4aa292ede8bc5d185c86df65.zip
Cargo fmt; better adapt with_capacity_values
Diffstat (limited to 'src/send.rs')
-rw-r--r--src/send.rs18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/send.rs b/src/send.rs
index a8cf966..f1df6f7 100644
--- a/src/send.rs
+++ b/src/send.rs
@@ -30,7 +30,7 @@ pub(crate) const ERROR_MARKER: ChunkLength = 0x4000;
pub(crate) const CHUNK_HAS_CONTINUATION: ChunkLength = 0x8000;
struct SendQueue {
- items: VecDeque<(u8, VecDeque<SendQueueItem>)>,
+ items: Vec<(u8, VecDeque<SendQueueItem>)>,
}
struct SendQueueItem {
@@ -42,7 +42,7 @@ struct SendQueueItem {
impl SendQueue {
fn new() -> Self {
Self {
- items: VecDeque::with_capacity(64),
+ items: Vec::with_capacity(64),
}
}
fn push(&mut self, item: SendQueueItem) {
@@ -56,20 +56,6 @@ impl SendQueue {
};
self.items[pos_prio].1.push_back(item);
}
- // used only in tests. They should probably be rewriten
- #[allow(dead_code)]
- fn pop(&mut self) -> Option<SendQueueItem> {
- match self.items.pop_front() {
- None => None,
- Some((prio, mut items_at_prio)) => {
- let ret = items_at_prio.pop_front();
- if !items_at_prio.is_empty() {
- self.items.push_front((prio, items_at_prio));
- }
- ret.or_else(|| self.pop())
- }
- }
- }
fn is_empty(&self) -> bool {
self.items.iter().all(|(_k, v)| v.is_empty())
}