pub fn del(
        self,
        index: u32,
        net: IpNetwork,
    ) -> AddressDelRequestFuture<impl Future<Item = AddressDelRequest, Error = NetlinkIpError>>
    {
        // get all address messages first, find the one matching the given IPNetwork
        // then create a delete request with the corresponding address message included
        let future = self.get().get_address_msgs_future().map(move |addr_msgs| {
            let msgs = addr_msgs
                .into_iter()
                .filter(|msg| msg.header.index == index)
                .find(|msg| {
                    if msg.header.prefix_len != net.prefix() {
                        return false;
                    }
                    for nla in msg.nlas.iter() {
                        match nla {
                            AddressNla::Unspec(bytes)
                            | AddressNla::Address(bytes)
                            | AddressNla::Local(bytes)
                            | AddressNla::Multicast(bytes)
                            | AddressNla::Anycast(bytes) => {
                                match bytes_to_ip_addr(&bytes[..]) {
                                    Ok(ip) => {
                                        if ip == net.ip() {
                                            return true;
                                        }
                                    }
                                    Err(_) => continue,
                                };
                            }
                            _ => continue,
                        }
                    }
                    return false;
                }).map(|msg| vec![msg])
                .unwrap_or(vec![]);
            AddressDelRequest::new(self.0.clone(), msgs)
        });
        AddressDelRequestFuture(future)
    }
/// Delete the given IP address on the interface with the given index
Delete the given IP address on the interface with the given index
Delete the given IP address on the interface with the given index
pub fn del(
        self,
        index: u32,
        net: IpNetwork,
    ) -> AddressDelRequestFuture<impl Future<Item = AddressDelRequest, Error = NetlinkIpError>>
    {
        // get all address messages first, find the one matching the given IPNetwork
        // then create a delete request with the corresponding address message included
        let future = self.get().get_address_msgs_future().map(move |addr_msgs| {
            let msgs = addr_msgs
                .into_iter()
                .filter(|msg| msg.header.index == index)
                .find(|msg| {
                    if msg.header.prefix_len != net.prefix() {
                        return false;
                    }
                    for nla in msg.nlas.iter() {
                        match nla {
                            AddressNla::Unspec(bytes)
                            | AddressNla::Address(bytes)
                            | AddressNla::Local(bytes)
                            | AddressNla::Multicast(bytes)
                            | AddressNla::Anycast(bytes) => {
                                match bytes_to_ip_addr(&bytes[..]) {
                                    Ok(ip) => {
                                        if ip == net.ip() {
                                            return true;
                                        }
                                    }
                                    Err(_) => continue,
                                };
                            }
                            _ => continue,
                        }
                    }
                    return false;
                }).map(|msg| vec![msg])
                .unwrap_or(vec![]);
            AddressDelRequest::new(self.0.clone(), msgs)
        });
        AddressDelRequestFuture(future)
    }
pub fn del ( self , index : u32 , net : IpNetwork , ) -> AddressDelRequestFuture < impl Future < Item = AddressDelRequest , Error = NetlinkIpError > > { // get all address messages first, find the one matching the given IPNetwork // then create a delete request with the corresponding address message included let future = self . get ( ) . get_address_msgs_future ( ) . map ( move | addr_msgs | { let msgs = addr_msgs . into_iter ( ) . filter ( | msg | msg . header . index == index ) . find ( | msg | { if msg . header . prefix_len != net . prefix ( ) { return false ; } for nla in msg . nlas . iter ( ) { match nla { AddressNla :: Unspec ( bytes ) | AddressNla :: Address ( bytes ) | AddressNla :: Local ( bytes ) | AddressNla :: Multicast ( bytes ) | AddressNla :: Anycast ( bytes ) => { match bytes_to_ip_addr ( & bytes [ .. ] ) { Ok ( ip ) => { if ip == net . ip ( ) { return true ; } } Err ( _ ) => continue , } ; } _ => continue , } } return false ; } ) . map ( | msg | vec ! [ msg ] ) . unwrap_or ( vec ! [ ] ) ; AddressDelRequest :: new ( self . 0 . clone ( ) , msgs ) } ) ; AddressDelRequestFuture ( future ) }
Delete the given IP address on the interface with the given index
Delete the given IP address on the interface with the given index
self
index
u32
net
IpNetwork
self
index
u32
net
IpNetwork