Always inline the contains function

This function is commonly called in a loop (or iterator). Inlining it
makes it run faster, which is beneficial in this case.
This commit is contained in:
Abhishek Chanda
2021-04-04 23:05:57 -05:00
parent 14108098d6
commit 9921661ebe
4 changed files with 4 additions and 1 deletions

View File

@ -174,6 +174,7 @@ impl Ipv6Network {
/// assert!(net.contains(Ipv6Addr::new(0xff01, 0, 0, 0, 0, 0, 0, 0x1)));
/// assert!(!net.contains(Ipv6Addr::new(0xffff, 0, 0, 0, 0, 0, 0, 0x1)));
/// ```
#[inline]
pub fn contains(&self, ip: Ipv6Addr) -> bool {
let a = self.addr.segments();
let b = ip.segments();