diff --git a/src/addr.rs b/src/addr.rs index bf96312a..449f22c9 100644 --- a/src/addr.rs +++ b/src/addr.rs @@ -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. @@ -447,26 +445,6 @@ impl Ord for Prefix { } } -//--- From - -#[cfg(feature = "repository")] -impl From 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 for crate::repository::resources::IpBlock { - fn from(src: Prefix) -> Self { - crate::repository::resources::Prefix::new( - src.addr(), src.len() - ).into() - } -} - //--- Deserialize and Serialize @@ -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)]