Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.63 KB | None | 0 0
  1. pub struct BcmMsgHead {
  2.     _opcode: u32,
  3.     _flags: u32,
  4.     /// number of frames to send before changing interval
  5.     _count: u32,
  6.     /// interval for the first count frames
  7.     _ival1: BcmTimeval,
  8.     /// interval for the following frames
  9.     _ival2: BcmTimeval,
  10.     _can_id: u32,
  11.     /// number of can frames appended to the message head
  12.     _nframes: u32,
  13.     /// buffer of CAN frames
  14.      _frames: [CanFrame; 0],
  15. }
  16.  
  17. impl BcmMsgHead {
  18.     #[inline]
  19.     pub fn frames(&self) -> &[CanFrame] {
  20.         return unsafe {
  21.             slice::from_raw_parts(self._frames.as_ptr(), self._nframes as usize)
  22.         };
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement