Skip to content

Commit

Permalink
Add (unused) TryFrom<NlriIter> on FixedNlriIter
Browse files Browse the repository at this point in the history
  • Loading branch information
DRiKE committed Dec 11, 2023
1 parent e5ebaa2 commit f35a328
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bgp/message/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,18 @@ impl<'a, Octs: Octets> Iterator for NlriIter<'a, Octs> {
}
}

impl<'a, Octs: Octets> TryFrom<NlriIter<'a, Octs>>
for FixedNlriIter<'a, Octs, nlri::Ipv4Unicast>
{
type Error = &'static str;
fn try_from(iter: NlriIter<'a, Octs>) -> Result<Self, Self::Error> {
if iter.afisafi() == AfiSafi::Ipv4Unicast {
return Ok(FixedNlriIter::new(&mut iter.into_parser()))
}
Err("can not convert into FixedNlriIter for Ipv4Unicast")
}
}


//--- Tests ------------------------------------------------------------------

Expand Down

0 comments on commit f35a328

Please sign in to comment.