SHARE
TWEET

Untitled

a guest Oct 21st, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pub struct ControlPacket {
  2.     type_and_flags: u8,
  3.     length: u16,
  4.     variable_header: Option<Vec<u8>>,
  5.     properties: Option<Vec<u8>>,
  6.     payload: Option<Vec<u8>>,
  7. }
  8.  
  9. impl<'a> From<&'a ControlPacket> for &'a [u8] {
  10.     fn from(packet: &'a ControlPacket) -> &'a [u8] {
  11.         match &packet.payload {
  12.             Some(payload) => payload.as_ref(),
  13.             None => panic!("don't know what to do"),
  14.         }
  15.     }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top