Skip to main content

ethtool/channel/
handle.rs

1// SPDX-License-Identifier: MIT
2
3use crate::{
4    EthtoolChannelGetRequest, EthtoolChannelSetRequest, EthtoolHandle,
5};
6
7pub struct EthtoolChannelHandle(EthtoolHandle);
8
9impl EthtoolChannelHandle {
10    pub fn new(handle: EthtoolHandle) -> Self {
11        EthtoolChannelHandle(handle)
12    }
13
14    /// Retrieve the ethtool Channels of a interface (equivalent to `ethtool -l
15    /// eth1`)
16    pub fn get(
17        &mut self,
18        iface_name: Option<&str>,
19    ) -> EthtoolChannelGetRequest {
20        EthtoolChannelGetRequest::new(self.0.clone(), iface_name)
21    }
22
23    /// Set the ethtool Channels of a interface (equivalent to `ethtool -L
24    /// eth1`)
25    pub fn set(&mut self, iface_name: &str) -> EthtoolChannelSetRequest {
26        EthtoolChannelSetRequest::new(self.0.clone(), iface_name)
27    }
28}