Skip to content

Commit a90449a

Browse files
authored
Remove unused code from the addr module. (#50)
This PR removes some code leftover from rpki-rs.
1 parent 8638fc8 commit a90449a

File tree

1 file changed

+9
-29
lines changed

1 file changed

+9
-29
lines changed

src/addr.rs

+9-29
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,8 @@ impl<'a> arbitrary::Arbitrary<'a> for FamilyAndLen {
233233
/// - Other than that, prefixes are sorted numerically from low to high
234234
///
235235
/// The rationale behind this ordering is that in most use cases processing a
236-
/// more-specific before any less-specific is more efficient (i.e. longest
237-
/// prefix matching in routing/forwarding)) or preventing unwanted
238-
/// intermediate stage (i.e. ROAs/VRPs for less-specifics making
239-
/// not-yet-processed more-specifics Invalid).
236+
/// more-specific before any less-specific is more efficient or preventing
237+
/// unwanted intermediate stage when evaluating prefixes in order.
240238
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
241239
pub struct Prefix {
242240
/// The address family and prefix length all in one.
@@ -447,26 +445,6 @@ impl Ord for Prefix {
447445
}
448446
}
449447

450-
//--- From
451-
452-
#[cfg(feature = "repository")]
453-
impl From<crate::repository::roa::FriendlyRoaIpAddress> for Prefix {
454-
fn from(addr: crate::repository::roa::FriendlyRoaIpAddress) -> Self {
455-
Prefix::new(
456-
addr.address(), addr.address_length()
457-
).expect("ROA IP address with illegal prefix length")
458-
}
459-
}
460-
461-
#[cfg(feature = "repository")]
462-
impl From<Prefix> for crate::repository::resources::IpBlock {
463-
fn from(src: Prefix) -> Self {
464-
crate::repository::resources::Prefix::new(
465-
src.addr(), src.len()
466-
).into()
467-
}
468-
}
469-
470448

471449
//--- Deserialize and Serialize
472450

@@ -560,18 +538,20 @@ impl<'a> arbitrary::Arbitrary<'a> for Prefix {
560538
/// The pair of a prefix and an optional max-len.
561539
///
562540
/// # Ordering
541+
///
563542
/// The ordering of MaxLenPrefixes is similar to the [ordering of
564543
/// Prefixes](Prefix#Ordering). The only difference is the optional MaxLen.
565544
/// When two prefixes are equal but differ in (presence of) max_len, the order
566545
/// is as follows:
567-
/// - any max_len always comes before no max_len
568-
/// - a larger (higher) max_len comes before a smaller (lower) max_len (e.g.
569-
/// 24 comes before 20). This is analog to how more-specifics come before
570-
/// less-specifics.
546+
///
547+
/// * any max_len always comes before no max_len
548+
/// * a larger (higher) max_len comes before a smaller (lower) max_len (e.g.
549+
/// 24 comes before 20). This is analog to how more-specifics come before
550+
/// less-specifics.
571551
///
572552
/// Note that the max_len can either be equal to the prefix length (with no
573553
/// practical difference from an omitted max_len) or larger than the prefix
574-
/// length. The max_len can not be smaller than the prefix length. Because of
554+
/// length. The max_len cannot be smaller than the prefix length. Because of
575555
/// that, we can safely order 'any max_len' before 'no max_len' for equal
576556
/// prefixes.
577557
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]

0 commit comments

Comments
 (0)