netlink_tc/link.rs
1use crate::{errors::LinkError, netlink, Link};
2
3/// `links` parses intermediate representation of netlink link messages `LinkMsg`s into `Link`s.
4pub fn links<T: netlink::NetlinkConnection>() -> Result<Vec<Link>, LinkError> {
5 let mut links = Vec::new();
6
7 let messages = T::new()?.links()?;
8 for message in messages {
9 links.push(Link {
10 index: message.header.index,
11 name: message.attr.name,
12 });
13 }
14
15 Ok(links)
16}