Skip to content

Commit

Permalink
Remove non_exhaustive annotation from structs (fixes rust-netlink#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hiner committed Mar 22, 2023
1 parent 75ce74c commit aa61722
Show file tree
Hide file tree
Showing 36 changed files with 3 additions and 46 deletions.
2 changes: 0 additions & 2 deletions src/rtnl/address/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ use netlink_packet_utils::{
use crate::{nlas::address::Nla, AddressMessageBuffer, ADDRESS_HEADER_LEN};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct AddressMessage {
pub header: AddressHeader,
pub nlas: Vec<Nla>,
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct AddressHeader {
pub family: u8,
pub prefix_len: u8,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/address/nlas/cache_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
#[non_exhaustive]
pub struct CacheInfo {
pub ifa_preferred: i32,
pub ifa_valid: i32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::{LinkMessageBuffer, LINK_HEADER_LEN};
///
/// `LinkHeader` exposes all these fields except for the "reserved" one.
#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct LinkHeader {
/// Address family: one of the `AF_*` constants.
pub interface_family: u8,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use netlink_packet_utils::{
use crate::{nlas::link::Nla, LinkHeader, LinkMessageBuffer};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct LinkMessage {
pub header: LinkHeader,
pub nlas: Vec<Nla>,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/af_spec_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for AfSpecBridge {
}

#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
#[non_exhaustive]
pub struct BridgeVlanInfo {
pub flags: u16,
pub vid: u16,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/inet/dev_conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ buffer!(InetDevConfBuffer(DEV_CONF_LEN) {
});

#[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub struct InetDevConf {
pub forwarding: i32,
pub mc_forwarding: i32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/inet6/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub struct Inet6CacheInfo {
pub max_reasm_len: i32,
pub tstamp: i32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/inet6/dev_conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ impl Emitable for Inet6DevConf {
}

#[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub struct Inet6DevConf {
pub forwarding: i32,
pub hoplimit: i32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/inet6/icmp6_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub struct Icmp6Stats {
pub num: i64,
pub in_msgs: i64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/inet6/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ buffer!(Inet6StatsBuffer(INET6_STATS_LEN) {
});

#[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub struct Inet6Stats {
pub num: i64,
pub in_pkts: i64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ buffer!(MapBuffer(LINK_MAP_LEN) {
});

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct Map {
pub memory_start: u64,
pub memory_end: u64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct Stats {
/// total packets received
pub rx_packets: u32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/link/nlas/stats64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ buffer!(Stats64Buffer(LINK_STATS64_LEN) {
});

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct Stats64 {
/// total packets received
pub rx_packets: u64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::{NeighbourMessageBuffer, NEIGHBOUR_HEADER_LEN};
///
/// `NeighbourHeader` exposes all these fields.
#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct NeighbourHeader {
pub family: u8,
pub ifindex: u32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use netlink_packet_utils::{
use crate::{nlas::neighbour::Nla, NeighbourHeader, NeighbourMessageBuffer};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct NeighbourMessage {
pub header: NeighbourHeader,
pub nlas: Vec<Nla>,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour/nlas/cache_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct CacheInfo {
pub confirmed: u32,
pub used: u32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour_table/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use netlink_packet_utils::{
use super::buffer::{NeighbourTableMessageBuffer, NEIGHBOUR_TABLE_HEADER_LEN};

#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub struct NeighbourTableHeader {
pub family: u8,
}
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour_table/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::{
};

#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub struct NeighbourTableMessage {
pub header: NeighbourTableHeader,
pub nlas: Vec<Nla>,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour_table/nlas/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct Config {
pub key_len: u16,
pub entry_size: u16,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/neighbour_table/nlas/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct Stats {
pub allocs: u64,
pub destroys: u64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/nsid/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use netlink_packet_utils::{
use super::{NsidMessageBuffer, NSID_HEADER_LEN};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct NsidHeader {
pub rtgen_family: u8,
}
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/nsid/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use netlink_packet_utils::{
use crate::{nlas::nsid::Nla, NsidHeader, NsidMessageBuffer};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct NsidMessage {
pub header: NsidHeader,
pub nlas: Vec<Nla>,
Expand Down
4 changes: 1 addition & 3 deletions src/rtnl/route/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use crate::{constants::*, RouteMessageBuffer, ROUTE_HEADER_LEN};

bitflags! {
/// Flags that can be set in a `RTM_GETROUTE` ([`RtnlMessage::GetRoute`]) message.
#[non_exhaustive]
pub struct RouteFlags: u32 {
pub struct RouteFlags: u32 {
/// If the route changes, notify the user via rtnetlink
const RTM_F_NOTIFY = RTM_F_NOTIFY;
/// This route is cloned. Cloned routes are routes coming from the cache instead of the
Expand Down Expand Up @@ -84,7 +83,6 @@ impl Default for RouteFlags {
/// }
/// ```
#[derive(Debug, PartialEq, Eq, Hash, Clone, Default)]
#[non_exhaustive]
pub struct RouteHeader {
/// Address family of the route: either [`AF_INET`] for IPv4 prefixes, or
/// [`AF_INET6`] for IPv6 prefixes.
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/route/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use netlink_packet_utils::{
use crate::{nlas::route::Nla, RouteHeader, RouteMessageBuffer};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct RouteMessage {
pub header: RouteHeader,
pub nlas: Vec<Nla>,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/route/nlas/cache_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct CacheInfo {
pub clntref: u32,
pub last_use: u32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/route/nlas/mfc_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use netlink_packet_utils::{
};

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct MfcStats {
pub packets: u64,
pub bytes: u64,
Expand Down
4 changes: 1 addition & 3 deletions src/rtnl/route/nlas/next_hops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use netlink_packet_utils::{
};

bitflags! {
#[non_exhaustive]
pub struct NextHopFlags: u8 {
pub struct NextHopFlags: u8 {
const RTNH_F_EMPTY = 0;
const RTNH_F_DEAD = constants::RTNH_F_DEAD;
const RTNH_F_PERVASIVE = constants::RTNH_F_PERVASIVE;
Expand Down Expand Up @@ -73,7 +72,6 @@ impl<'a, T: AsRef<[u8]> + ?Sized> NextHopBuffer<&'a T> {
}

#[derive(Debug, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub struct NextHop {
/// Next-hop flags (see [`NextHopFlags`])
pub flags: NextHopFlags,
Expand Down
4 changes: 1 addition & 3 deletions src/rtnl/rule/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use super::{buffer::RuleMessageBuffer, RULE_HEADER_LEN};
use crate::constants::*;

bitflags! {
#[non_exhaustive]
pub struct RuleFlags: u32 {
pub struct RuleFlags: u32 {
const FIB_RULE_PERMANENT = FIB_RULE_PERMANENT;
const FIB_RULE_INVERT = FIB_RULE_INVERT;
const FIB_RULE_UNRESOLVED = FIB_RULE_UNRESOLVED;
Expand All @@ -30,7 +29,6 @@ impl Default for RuleFlags {
// see https://github.com/torvalds/linux/blob/master/include/uapi/linux/fib_rules.h
// see https://github.com/torvalds/linux/blob/master/include/net/fib_rules.h
#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct RuleHeader {
/// Address family: one of the `AF_*` constants.
pub family: u8,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/rule/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use netlink_packet_utils::{
use super::{buffer::RuleMessageBuffer, header::RuleHeader, nlas::Nla};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct RuleMessage {
pub header: RuleHeader,
pub nlas: Vec<Nla>,
Expand Down
2 changes: 0 additions & 2 deletions src/rtnl/tc/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
};

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct TcMessage {
pub header: TcHeader,
pub nlas: Vec<Nla>,
Expand Down Expand Up @@ -43,7 +42,6 @@ impl TcMessage {
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct TcHeader {
pub family: u8,
// Interface index
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/tc/nlas/action/mirred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for Nla {
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct TcMirred {
pub index: u32,
pub capab: u32,
Expand Down
2 changes: 0 additions & 2 deletions src/rtnl/tc/nlas/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use crate::tc::{constants::*, Stats2};
pub const TC_GEN_BUF_LEN: usize = 20;

#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub struct Action {
pub tab: u16,
pub nlas: Vec<ActNla>,
Expand Down Expand Up @@ -213,7 +212,6 @@ where
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct TcGen {
pub index: u32,
pub capab: u32,
Expand Down
2 changes: 0 additions & 2 deletions src/rtnl/tc/nlas/filter/u32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>> for Nla {
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct Sel {
pub flags: u8,
pub offshift: u8,
Expand Down Expand Up @@ -219,7 +218,6 @@ impl<T: AsRef<[u8]> + ?Sized> Parseable<SelBuffer<&T>> for Sel {
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[non_exhaustive]
pub struct Key {
pub mask: u32,
pub val: u32,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/tc/nlas/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use netlink_packet_utils::{

/// Generic queue statistics
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[non_exhaustive]
pub struct Stats {
/// Number of enqueued bytes
pub bytes: u64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/tc/nlas/stats_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use netlink_packet_utils::{

/// Byte/Packet throughput statistics
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[non_exhaustive]
pub struct StatsBasic {
/// number of seen bytes
pub bytes: u64,
Expand Down
1 change: 0 additions & 1 deletion src/rtnl/tc/nlas/stats_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use netlink_packet_utils::{

/// Queuing statistics
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[non_exhaustive]
pub struct StatsQueue {
/// queue length
pub qlen: u32,
Expand Down

0 comments on commit aa61722

Please sign in to comment.