Skip to content

Commit

Permalink
protocols/kad: Update arrayvec dependency to latest version 0.7.2 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hrxi committed May 16, 2022
1 parent d69681b commit efe9c07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion protocols/kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions protocols/kad/src/kbucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
}
Expand All @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/kbucket/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down

0 comments on commit efe9c07

Please sign in to comment.