pub struct CapturingDataLink<D: DataLink> { /* private fields */ }Expand description
A DataLink wrapper that captures all frames to a PCAP file.
let transport = BacnetIpTransport::bind("0.0.0.0:47808".parse()?).await?;
let capturing = CapturingDataLink::to_file(transport, "capture.pcap")?;
// Use `capturing` as your DataLink — all traffic is logged.Implementations§
Trait Implementations§
Source§impl<D: DataLink> DataLink for CapturingDataLink<D>
impl<D: DataLink> DataLink for CapturingDataLink<D>
Source§async fn send(
&self,
address: DataLinkAddress,
payload: &[u8],
) -> Result<(), DataLinkError>
async fn send( &self, address: DataLinkAddress, payload: &[u8], ) -> Result<(), DataLinkError>
Sends
payload to the given data-link address.Source§async fn recv(
&self,
buf: &mut [u8],
) -> Result<(usize, DataLinkAddress), DataLinkError>
async fn recv( &self, buf: &mut [u8], ) -> Result<(usize, DataLinkAddress), DataLinkError>
Receives a frame into
buf, returning (bytes_read, source_address).Auto Trait Implementations§
impl<D> Freeze for CapturingDataLink<D>where
D: Freeze,
impl<D> !RefUnwindSafe for CapturingDataLink<D>
impl<D> Send for CapturingDataLink<D>
impl<D> Sync for CapturingDataLink<D>
impl<D> Unpin for CapturingDataLink<D>where
D: Unpin,
impl<D> UnsafeUnpin for CapturingDataLink<D>where
D: UnsafeUnpin,
impl<D> !UnwindSafe for CapturingDataLink<D>
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