From efe9c07b34a45c76bacd5cc89435622026834ac0 Mon Sep 17 00:00:00 2001 From: hrxi Date: Mon, 16 May 2022 18:52:19 +0200 Subject: [PATCH] protocols/kad: Update `arrayvec` dependency to latest version 0.7.2 (#2644) --- protocols/kad/Cargo.toml | 2 +- protocols/kad/src/kbucket.rs | 8 ++++---- protocols/kad/src/kbucket/bucket.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index aea82612..a7410670 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["peer-to-peer", "libp2p", "networking"] categories = ["network-programming", "asynchronous"] [dependencies] -arrayvec = "0.5.1" +arrayvec = "0.7.2" bytes = "1" either = "1.5" fnv = "1.0" diff --git a/protocols/kad/src/kbucket.rs b/protocols/kad/src/kbucket.rs index 8b85a65b..d1c8622d 100644 --- a/protocols/kad/src/kbucket.rs +++ b/protocols/kad/src/kbucket.rs @@ -248,7 +248,7 @@ where iter: None, table: self, buckets_iter: ClosestBucketsIter::new(distance), - fmap: |b: &KBucket| -> ArrayVec<_> { + fmap: |b: &KBucket| -> ArrayVec<_, { K_VALUE.get() }> { b.iter().map(|(n, _)| n.key.clone()).collect() }, } @@ -270,7 +270,7 @@ where iter: None, table: self, buckets_iter: ClosestBucketsIter::new(distance), - fmap: |b: &KBucket<_, TVal>| -> ArrayVec<_> { + fmap: |b: &KBucket<_, TVal>| -> ArrayVec<_, { K_VALUE.get() }> { b.iter() .map(|(n, status)| EntryView { node: n.clone(), @@ -320,7 +320,7 @@ struct ClosestIter<'a, TTarget, TKey, TVal, TMap, TOut> { /// distance of the local key to the target. buckets_iter: ClosestBucketsIter, /// The iterator over the entries in the currently traversed bucket. - iter: Option>, + iter: Option>, /// The projection function / mapping applied on each bucket as /// it is encountered, producing the next `iter`ator. fmap: TMap, @@ -425,7 +425,7 @@ where TTarget: AsRef, TKey: Clone + AsRef, TVal: Clone, - TMap: Fn(&KBucket) -> ArrayVec<[TOut; K_VALUE.get()]>, + TMap: Fn(&KBucket) -> ArrayVec, TOut: AsRef, { type Item = TOut; diff --git a/protocols/kad/src/kbucket/bucket.rs b/protocols/kad/src/kbucket/bucket.rs index 92dc6c57..0e3ad368 100644 --- a/protocols/kad/src/kbucket/bucket.rs +++ b/protocols/kad/src/kbucket/bucket.rs @@ -101,7 +101,7 @@ pub struct Position(usize); #[derive(Debug, Clone)] pub struct KBucket { /// The nodes contained in the bucket. - nodes: ArrayVec<[Node; K_VALUE.get()]>, + nodes: ArrayVec, { K_VALUE.get() }>, /// The position (index) in `nodes` that marks the first connected node. ///