TunPacket already stores the packet internally using bytes::Bytes, but it can only be constructed from a Vec via TunPacket::new. It would be nice to have a way (either a method of a From trait impl) to construct a TunPacket from Bytes directly, without going through the extra cloning in Bytes -> Vec -> Bytes.
Code pointer: https://github.com/meh/rust-tun/blob/e762c419d71438e67379f9b2fed89b5cb835cc6a/src/async/codec.rs#L77C1-L80C2
TunPacket
already stores the packet internally usingbytes::Bytes
, but it can only be constructed from aVec
viaTunPacket::new
. It would be nice to have a way (either a method of aFrom
trait impl) to construct aTunPacket
fromBytes
directly, without going through the extra cloning inBytes -> Vec -> Bytes
.