Struct pnet_datalink::dummy::Config
source · pub struct Config { /* private fields */ }
Expand description
Configuration for the dummy datalink backend. Contains std::sync::mpsc
channels that are used to communicate with the fake network.
Implementations§
source§impl Config
impl Config
sourcepub fn new(
receiver: Receiver<Result<Box<[u8]>>>,
sender: Sender<Box<[u8]>>
) -> Config
pub fn new( receiver: Receiver<Result<Box<[u8]>>>, sender: Sender<Box<[u8]>> ) -> Config
Creates a new Config
with the given channels as the backing network.
When using this constructor inject_handle
and read_handle
will return None
.
Those handles must be kept track of elsewhere.
The DataLinkReceiver
created by the dummy backend will read packets from
receiver
. Both network errors and data can be sent on this channel.
When the receiver
channel is closed (Sender
is dropped)
DataLinkReceiver::next()
will sleep forever, simlating an idle network.
The DataLinkSender
created by the dummy backend will send all packets sent
through build_and_send()
and send_to()
to the sender
channel.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Config
impl Send for Config
impl !Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more