Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 135 additions & 179 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
name = "cidrs"
description = "CIDR Library"
version = "0.2.0"
authors = ["zarvd <jialun.cai@pm.me>"]
authors = ["Jialun Cai <jialun.cai@pm.me>"]
keywords = ["Network", "IP", "CIDR"]
homepage = "https://github.com/zarvd/cidrs"
repository = "https://github.com/zarvd/cidrs"
homepage = "https://github.com/clnv/cidrs"
repository = "https://github.com/clnv/cidrs"
documentation = "https://docs.rs/cidrs"
license = "MIT"
edition = "2021"
edition = "2024"

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# CIDRs

[<img alt="github" height="20" src="https://img.shields.io/badge/github-zarvd/cidrs-8da0cb?style=for-the-badge&labelColor=555555&logo=github">](https://github.com/zarvd/cidrs)
[<img alt="github" height="20" src="https://img.shields.io/badge/github-clnv/cidrs-8da0cb?style=for-the-badge&labelColor=555555&logo=github">](https://github.com/clnv/cidrs)
[<img alt="crates.io" height="20" src="https://img.shields.io/crates/v/cidrs.svg?style=for-the-badge&color=fc8d62&logo=rust">](https://crates.io/crates/cidrs)
[<img alt="docs.rs" height="20" src="https://img.shields.io/docsrs/cidrs?style=for-the-badge">](https://docs.rs/cidrs)
[<img alt="build status" height="20" src="https://img.shields.io/github/actions/workflow/status/zarvd/cidrs/ci.yml?branch=master&style=for-the-badge">](https://github.com/zarvd/cidrs/actions?query%3Amaster)
[<img alt="dependency status" height="20" src="https://deps.rs/repo/github/zarvd/cidrs/status.svg?style=for-the-badge&t=0">](https://deps.rs/repo/github/zarvd/cidrs)
[<img alt="build status" height="20" src="https://img.shields.io/github/actions/workflow/status/clnv/cidrs/ci.yml?branch=master&style=for-the-badge">](https://github.com/clnv/cidrs/actions?query%3Amaster)
[<img alt="dependency status" height="20" src="https://deps.rs/repo/github/clnv/cidrs/status.svg?style=for-the-badge&t=0">](https://deps.rs/repo/github/clnv/cidrs)

This library provides a set of types and functions for working with IP CIDRs.

Expand Down
2 changes: 1 addition & 1 deletion benches/aggregate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cidrs::Ipv4Cidr;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{Criterion, black_box, criterion_group, criterion_main};

fn ipv4_fixture() -> Vec<Ipv4Cidr> {
(0..255)
Expand Down
2 changes: 1 addition & 1 deletion benches/routing_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::hint::black_box;
use std::net::{IpAddr, Ipv4Addr};

use cidrs::{Cidr, CidrRoutingTable, Ipv4Cidr};
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};

fn fixture() -> CidrRoutingTable<u64> {
let mut m = CidrRoutingTable::new();
Expand Down
7 changes: 3 additions & 4 deletions src/routing_table/tree_bitmap/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ where
break;
};
}
if !is_end {
if let Some(v) = unsafe { node.as_ref() }.get_longest_match_value(Nibble::nil()) {
rv.push(v);
}
if !is_end && let Some(v) = unsafe { node.as_ref() }.get_longest_match_value(Nibble::nil())
{
rv.push(v);
}

rv.into_iter().map(|(k, v)| (*k, v)).collect()
Expand Down
2 changes: 1 addition & 1 deletion src/routing_table/tree_bitmap/nibble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<const N: usize> Iterator for Nibbles<N> {
let byte = {
let i = (self.cursor / 8) as usize;
let b = self.bytes[i];
let b = if self.cursor % 8 == 0 {
let b = if self.cursor.is_multiple_of(8) {
b >> 4
} else {
b & 0x0f
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cidrs::{aggregate_ipv4, Ipv4Cidr};
use cidrs::{Ipv4Cidr, aggregate_ipv4};

#[test]
fn ipv4_basic() {
Expand Down
4 changes: 2 additions & 2 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "xtask"
version = "0.1.0"
authors = ["zarvd <jialun.cai@pm.me>"]
edition = "2021"
authors = ["Jialun Cai <jialun.cai@pm.me>"]
edition = "2024"

[dependencies]
anyhow = "1"
Expand Down