meh / rust-tun

TUN device creation and handling.
340 stars 133 forks source link

feat: add TunPacket::into_bytes() #49

Closed imlk0 closed 1 year ago

imlk0 commented 1 year ago

This comment add a function TunPacket::into_bytes() to struct TunPacket, which allows users to consume TunPacket and return the inner Bytes instences.

Thus we can avoid copy in the following code:

let bytes = Bytes::from(packet.get_bytes().to_owned())
imlk0 commented 1 year ago

@meh Hello meh, this PR is ready for review now.