diff --git a/src/lib.rs b/src/lib.rs
index b5f6f20..af2ff07 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,7 +42,7 @@ pub use address::addr::*;
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
)]
#[cfg_attr(feature = "bytecheck", archive_attr(derive(rkyv::CheckBytes)))]
-pub struct IpLookupTable {
+pub struct IpLookupTable {
inner: TreeBitmap,
_addrtype: PhantomData,
}
@@ -424,7 +424,7 @@ where
/// Iterator over prefixes and associated values. The prefixes are returned in
/// "tree"-order.
#[doc(hidden)]
-pub struct Iter<'a, A, T: 'a + Clone + Copy + Default> {
+pub struct Iter<'a, A, T: 'a> {
inner: tree_bitmap::Iter<'a, T>,
_addrtype: PhantomData,
}
@@ -432,7 +432,7 @@ pub struct Iter<'a, A, T: 'a + Clone + Copy + Default> {
/// Mutable iterator over prefixes and associated values. The prefixes are
/// returned in "tree"-order.
#[doc(hidden)]
-pub struct IterMut<'a, A, T: 'a + Clone + Copy + Default> {
+pub struct IterMut<'a, A, T: 'a> {
inner: tree_bitmap::IterMut<'a, T>,
_addrtype: PhantomData,
}
@@ -440,7 +440,7 @@ pub struct IterMut<'a, A, T: 'a + Clone + Copy + Default> {
/// Converts ```IpLookupTable``` into an iterator. The prefixes are returned in
/// "tree"-order.
#[doc(hidden)]
-pub struct IntoIter {
+pub struct IntoIter {
inner: tree_bitmap::IntoIter,
_addrtype: PhantomData,
}
diff --git a/src/tree_bitmap/allocator.rs b/src/tree_bitmap/allocator.rs
index 9c360af..5d8a96c 100644
--- a/src/tree_bitmap/allocator.rs
+++ b/src/tree_bitmap/allocator.rs
@@ -188,7 +188,7 @@ pub fn choose_bucket(len: u32) -> u32 {
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
)]
#[cfg_attr(feature = "bytecheck", archive_attr(derive(rkyv::CheckBytes)))]
-pub struct Allocator {
+pub struct Allocator {
pub(crate) buckets: [BucketVec; 9],
}
diff --git a/src/tree_bitmap/mod.rs b/src/tree_bitmap/mod.rs
index 8dc8e38..0022902 100644
--- a/src/tree_bitmap/mod.rs
+++ b/src/tree_bitmap/mod.rs
@@ -22,7 +22,7 @@ use self::node::{MatchResult, Node};
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
)]
#[cfg_attr(feature = "bytecheck", archive_attr(derive(rkyv::CheckBytes)))]
-pub struct TreeBitmap {
+pub struct TreeBitmap {
trienodes: Allocator,
results: Allocator,
len: usize,
@@ -391,13 +391,13 @@ struct PathElem {
pos: usize,
}
-pub struct Iter<'a, T: 'a + Clone + Copy + Default> {
+pub struct Iter<'a, T: 'a> {
inner: &'a TreeBitmap,
path: Vec,
nibbles: Vec,
}
-pub struct IterMut<'a, T: 'a + Clone + Copy + Default> {
+pub struct IterMut<'a, T: 'a> {
inner: &'a mut TreeBitmap,
path: Vec,
nibbles: Vec,
@@ -413,7 +413,7 @@ static PREFIX_OF_BIT: [u8; 32] = [// 0 1 2 3 4 5
// 24 25 26 27 28 29 30 31
0b1000, 0b1001, 0b1010, 0b1011, 0b1100, 0b1101, 0b1110, 0b1111];
-fn next(
+fn next(
trie: &TreeBitmap,
path: &mut Vec,
nibbles: &mut Vec,
@@ -488,7 +488,7 @@ impl<'a, T: 'a + Clone + Copy + Default> Iterator for IterMut<'a, T> {
}
}
-pub struct IntoIter {
+pub struct IntoIter {
inner: TreeBitmap,
path: Vec,
nibbles: Vec,
@@ -526,7 +526,7 @@ impl IntoIterator for TreeBitmap {
}
}
-pub struct MatchesMut<'a, T: 'a + Clone + Copy + Default> {
+pub struct MatchesMut<'a, T: 'a> {
inner: &'a mut TreeBitmap,
path: std::vec::IntoIter<(u32, AllocatorHandle, u32)>,
}
@@ -546,7 +546,7 @@ impl<'a, T: 'a + Clone + Copy + Default> Iterator for MatchesMut<'a, T> {
}
}
-impl TrieAccess for TreeBitmap {
+impl TrieAccess for TreeBitmap {
fn get_node(&self, hdl: &AllocatorHandle, index: u32) -> Node {
*self.trienodes.get(&hdl, index)
}
diff --git a/src/tree_bitmap/rkyv_impl.rs b/src/tree_bitmap/rkyv_impl.rs
index 3853912..ae40c25 100644
--- a/src/tree_bitmap/rkyv_impl.rs
+++ b/src/tree_bitmap/rkyv_impl.rs
@@ -108,22 +108,26 @@ mod tests {
let ip_2 = Ipv6Addr::new(0x2001, 0xdb8, 0xcafe, 0xf00, 0xf00, 0xf00, 0, 1);
assert_eq!(table.longest_match(ip_2), Some((less_specific, 32, &123)));
-
- let rkyv_bytes = rkyv::to_bytes::<_, 1024>(&table).unwrap();
- let rkyv_table =
- rkyv::check_archived_root::>(&rkyv_bytes).unwrap();
-
- assert!(!rkyv_table.is_empty());
- assert_eq!(rkyv_table.len(), 2);
-
- assert_eq!(rkyv_table.exact_match(ip_1, 48), Some(&321));
- assert_eq!(
- rkyv_table.longest_match(ip_1),
- Some((more_specific, 48, &321))
- );
- assert_eq!(
- rkyv_table.longest_match(ip_2),
- Some((less_specific, 32, &123))
- );
+ rkyv::to_bytes::<_, 1024>(&table).unwrap();
+
+ #[cfg(feature = "bytecheck")]
+ {
+ let rkyv_bytes = rkyv::to_bytes::<_, 1024>(&table).unwrap();
+ let rkyv_table =
+ rkyv::check_archived_root::>(&rkyv_bytes).unwrap();
+
+ assert!(!rkyv_table.is_empty());
+ assert_eq!(rkyv_table.len(), 2);
+
+ assert_eq!(rkyv_table.exact_match(ip_1, 48), Some(&321));
+ assert_eq!(
+ rkyv_table.longest_match(ip_1),
+ Some((more_specific, 48, &321))
+ );
+ assert_eq!(
+ rkyv_table.longest_match(ip_2),
+ Some((less_specific, 32, &123))
+ );
+ }
}
}