Skip to content

Commit

Permalink
Clean up public exports
Browse files Browse the repository at this point in the history
Instead of `pub use foo::*`, we should be explicitly define our public
types.

Signed-off-by: Gris Ge <[email protected]>
  • Loading branch information
cathay4t committed Jun 29, 2024
1 parent a4d2611 commit e50de93
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 93 deletions.
14 changes: 6 additions & 8 deletions src/addr/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// SPDX-License-Identifier: MIT

mod handle;
pub use self::handle::*;

mod add;
pub use self::add::*;

mod del;
pub use self::del::*;

mod get;
pub use self::get::*;
mod handle;

pub use self::add::AddressAddRequest;
pub use self::del::AddressDelRequest;
pub use self::get::AddressGetRequest;
pub use self::handle::AddressHandle;
69 changes: 40 additions & 29 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,51 @@ pub use netlink_packet_utils as packet_utils;
pub use netlink_proto as proto;
pub use netlink_sys as sys;

mod addr;
mod connection;
pub mod constants;
mod errors;
mod handle;
pub use crate::handle::*;

mod link;
mod macros;
mod neighbour;
#[cfg(not(target_os = "freebsd"))]
mod ns;
#[cfg(not(target_os = "freebsd"))]
pub use crate::ns::*;

mod errors;
pub use crate::errors::*;

mod link;
pub use crate::link::*;

mod addr;
pub use crate::addr::*;

mod route;
pub use crate::route::*;

mod rule;
pub use crate::rule::*;

mod connection;
pub use crate::connection::*;

#[cfg(not(target_os = "freebsd"))]
mod traffic_control;
#[cfg(not(target_os = "freebsd"))]
pub use crate::traffic_control::*;

mod neighbour;
pub use crate::neighbour::*;

pub mod constants;

mod macros;
pub use crate::addr::{
AddressAddRequest, AddressDelRequest, AddressGetRequest, AddressHandle,
};
#[cfg(feature = "tokio_socket")]
pub use crate::connection::new_connection;
pub use crate::connection::new_connection_with_socket;
pub use crate::errors::Error;
pub use crate::handle::Handle;
pub use crate::link::{
BondAddRequest, BondPortSetRequest, LinkAddRequest, LinkDelPropRequest,
LinkDelRequest, LinkGetRequest, LinkHandle, LinkNewPropRequest,
LinkSetRequest, QosMapping, VxlanAddRequest,
};
pub use crate::neighbour::{
NeighbourAddRequest, NeighbourDelRequest, NeighbourGetRequest,
NeighbourHandle,
};
#[cfg(not(target_os = "freebsd"))]
pub use crate::ns::{NetworkNamespace, NETNS_PATH, NONE_FS, SELF_NS_PATH};
pub use crate::route::{
IpVersion, RouteAddRequest, RouteDelRequest, RouteGetRequest, RouteHandle,
RouteMessageBuilder,
};
pub use crate::rule::{
RuleAddRequest, RuleDelRequest, RuleGetRequest, RuleHandle,
};
#[cfg(not(target_os = "freebsd"))]
pub use crate::traffic_control::{
QDiscDelRequest, QDiscGetRequest, QDiscHandle, QDiscNewRequest,
TrafficChainGetRequest, TrafficChainHandle, TrafficClassGetRequest,
TrafficClassHandle, TrafficFilterGetRequest, TrafficFilterHandle,
TrafficFilterNewRequest,
};
30 changes: 13 additions & 17 deletions src/link/mod.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
// SPDX-License-Identifier: MIT

mod handle;
pub use self::handle::*;

mod add;
pub use self::add::*;

mod del;
pub use self::del::*;

mod get;
pub use self::get::*;

mod handle;
mod property_add;
mod property_del;
mod set;
pub use self::set::*;

mod set_bond_port;
pub use self::set_bond_port::*;

mod property_add;
pub use self::property_add::*;

mod property_del;
pub use self::property_del::*;
pub use self::add::{
BondAddRequest, LinkAddRequest, QosMapping, VxlanAddRequest,
};
pub use self::del::LinkDelRequest;
pub use self::get::LinkGetRequest;
pub use self::handle::LinkHandle;
pub use self::property_add::LinkNewPropRequest;
pub use self::property_del::LinkDelPropRequest;
pub use self::set::LinkSetRequest;
pub use self::set_bond_port::BondPortSetRequest;

#[cfg(test)]
mod test;
16 changes: 7 additions & 9 deletions src/neighbour/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// SPDX-License-Identifier: MIT

mod handle;
pub use self::handle::*;

mod get;
pub use self::get::*;

mod add;
pub use self::add::*;

mod del;
pub use self::del::*;
mod get;
mod handle;

pub use self::add::NeighbourAddRequest;
pub use self::del::NeighbourDelRequest;
pub use self::get::NeighbourGetRequest;
pub use self::handle::NeighbourHandle;
15 changes: 6 additions & 9 deletions src/route/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// SPDX-License-Identifier: MIT

mod handle;
pub use self::handle::*;

mod add;
pub use self::add::*;

mod builder;
mod del;
pub use self::del::*;

mod get;
pub use self::get::*;
mod handle;

mod builder;
pub use self::add::RouteAddRequest;
pub use self::builder::RouteMessageBuilder;
pub use self::del::RouteDelRequest;
pub use self::get::{IpVersion, RouteGetRequest};
pub use self::handle::RouteHandle;
14 changes: 6 additions & 8 deletions src/rule/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// SPDX-License-Identifier: MIT

mod handle;
pub use self::handle::*;

mod add;
pub use self::add::*;

mod del;
pub use self::del::*;

mod get;
pub use self::get::*;
mod handle;

pub use self::add::RuleAddRequest;
pub use self::del::RuleDelRequest;
pub use self::get::RuleGetRequest;
pub use self::handle::RuleHandle;
27 changes: 14 additions & 13 deletions src/traffic_control/mod.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// SPDX-License-Identifier: MIT

mod handle;
pub use self::handle::*;

mod get;
pub use self::get::*;

mod add_filter;
mod add_qdisc;
pub use self::add_qdisc::*;

mod del_qdisc;
pub use self::del_qdisc::*;

mod add_filter;
pub use self::add_filter::*;

mod get;
mod handle;
#[cfg(test)]
mod test;

pub use self::add_filter::TrafficFilterNewRequest;
pub use self::add_qdisc::QDiscNewRequest;
pub use self::del_qdisc::QDiscDelRequest;
pub use self::get::{
QDiscGetRequest, TrafficChainGetRequest, TrafficClassGetRequest,
TrafficFilterGetRequest,
};
pub use self::handle::{
QDiscHandle, TrafficChainHandle, TrafficClassHandle, TrafficFilterHandle,
};

0 comments on commit e50de93

Please sign in to comment.