diff options
author | Himbeer <himbeer@disroot.org> | 2025-03-20 16:22:29 +0100 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2025-03-20 16:22:29 +0100 |
commit | 77324961b27a9361ab8ebe2b8173af348242421a (patch) | |
tree | b88c777a2b7bc929364ef81435d8f09c9bf4bc62 | |
parent | 9d55957b737cce1ace694376bdd157624286c020 (diff) |
Derive Clone for route and rule descriptions
-rw-r--r-- | src/route.rs | 4 | ||||
-rw-r--r-- | src/rule.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/route.rs b/src/route.rs index b5a03c6..b1728cd 100644 --- a/src/route.rs +++ b/src/route.rs @@ -9,7 +9,7 @@ use netlink_packet_route::route::{RouteAttribute, RouteMessage, RouteScope}; use rtnetlink::IpVersion; /// An IPv4 route configuration. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Route4 { /// The destination prefix this route applies to. pub dst: Ipv4Addr, @@ -29,7 +29,7 @@ pub struct Route4 { } /// An IPv6 route configuration. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Route6 { /// The destination prefix this route applies to. pub dst: Ipv6Addr, diff --git a/src/rule.rs b/src/rule.rs index bd68c73..7b8d5cc 100644 --- a/src/rule.rs +++ b/src/rule.rs @@ -10,8 +10,8 @@ use netlink_packet_route::rule::RuleFlag; use rtnetlink::RuleAddRequest; /// A rule entry. -#[derive(Debug)] -pub struct Rule<T> { +#[derive(Clone, Debug)] +pub struct Rule<T: Clone> { /// Whether to invert the matching criteria. pub invert: bool, /// Firewall mark to match against. @@ -122,7 +122,7 @@ impl Rule<Ipv6Addr> { } } -impl<T> Rule<T> { +impl<T: Clone> Rule<T> { fn prepare_add(&self, c: &Connection) -> RuleAddRequest { let mut add = c.handle().rule().add().action(self.action); |