protocols/kad: Update arrayvec dependency to latest version 0.7.2 (#2644)

This commit is contained in:
hrxi
2022-05-16 18:52:19 +02:00
committed by GitHub
parent d69681b27c
commit efe9c07b34
3 changed files with 6 additions and 6 deletions

View File

@ -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"

View File

@ -248,7 +248,7 @@ where
iter: None,
table: self,
buckets_iter: ClosestBucketsIter::new(distance),
fmap: |b: &KBucket<TKey, _>| -> ArrayVec<_> {
fmap: |b: &KBucket<TKey, _>| -> 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<arrayvec::IntoIter<[TOut; K_VALUE.get()]>>,
iter: Option<arrayvec::IntoIter<TOut, { K_VALUE.get() }>>,
/// 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<KeyBytes>,
TKey: Clone + AsRef<KeyBytes>,
TVal: Clone,
TMap: Fn(&KBucket<TKey, TVal>) -> ArrayVec<[TOut; K_VALUE.get()]>,
TMap: Fn(&KBucket<TKey, TVal>) -> ArrayVec<TOut, { K_VALUE.get() }>,
TOut: AsRef<KeyBytes>,
{
type Item = TOut;

View File

@ -101,7 +101,7 @@ pub struct Position(usize);
#[derive(Debug, Clone)]
pub struct KBucket<TKey, TVal> {
/// The nodes contained in the bucket.
nodes: ArrayVec<[Node<TKey, TVal>; K_VALUE.get()]>,
nodes: ArrayVec<Node<TKey, TVal>, { K_VALUE.get() }>,
/// The position (index) in `nodes` that marks the first connected node.
///