Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code from the addr module. #50

Merged
merged 1 commit into from
Mar 21, 2024
Merged
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
38 changes: 9 additions & 29 deletions src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,8 @@ impl<'a> arbitrary::Arbitrary<'a> for FamilyAndLen {
/// - Other than that, prefixes are sorted numerically from low to high
///
/// The rationale behind this ordering is that in most use cases processing a
/// more-specific before any less-specific is more efficient (i.e. longest
/// prefix matching in routing/forwarding)) or preventing unwanted
/// intermediate stage (i.e. ROAs/VRPs for less-specifics making
/// not-yet-processed more-specifics Invalid).
/// more-specific before any less-specific is more efficient or preventing
/// unwanted intermediate stage when evaluating prefixes in order.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct Prefix {
/// The address family and prefix length all in one.
Expand Down Expand Up @@ -447,26 +445,6 @@ impl Ord for Prefix {
}
}

//--- From

#[cfg(feature = "repository")]
impl From<crate::repository::roa::FriendlyRoaIpAddress> for Prefix {
fn from(addr: crate::repository::roa::FriendlyRoaIpAddress) -> Self {
Prefix::new(
addr.address(), addr.address_length()
).expect("ROA IP address with illegal prefix length")
}
}

#[cfg(feature = "repository")]
impl From<Prefix> for crate::repository::resources::IpBlock {
fn from(src: Prefix) -> Self {
crate::repository::resources::Prefix::new(
src.addr(), src.len()
).into()
}
}


//--- Deserialize and Serialize

Expand Down Expand Up @@ -560,18 +538,20 @@ impl<'a> arbitrary::Arbitrary<'a> for Prefix {
/// The pair of a prefix and an optional max-len.
///
/// # Ordering
///
/// The ordering of MaxLenPrefixes is similar to the [ordering of
/// Prefixes](Prefix#Ordering). The only difference is the optional MaxLen.
/// When two prefixes are equal but differ in (presence of) max_len, the order
/// is as follows:
/// - any max_len always comes before no max_len
/// - a larger (higher) max_len comes before a smaller (lower) max_len (e.g.
/// 24 comes before 20). This is analog to how more-specifics come before
/// less-specifics.
///
/// * any max_len always comes before no max_len
/// * a larger (higher) max_len comes before a smaller (lower) max_len (e.g.
/// 24 comes before 20). This is analog to how more-specifics come before
/// less-specifics.
///
/// Note that the max_len can either be equal to the prefix length (with no
/// practical difference from an omitted max_len) or larger than the prefix
/// length. The max_len can not be smaller than the prefix length. Because of
/// length. The max_len cannot be smaller than the prefix length. Because of
/// that, we can safely order 'any max_len' before 'no max_len' for equal
/// prefixes.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
Expand Down
Loading