pub struct RawEvent<'a> {
pub metadata: EventMetadata,
pub len: u32,
pub event_type: u16,
pub nparams: u32,
pub payload: &'a [u8],
}
Fields§
§metadata: EventMetadata
§len: u32
§event_type: u16
§nparams: u32
§payload: &'a [u8]
Implementations§
source§impl RawEvent<'_>
impl RawEvent<'_>
pub fn from(buf: &[u8]) -> Result<RawEvent<'_>>
sourcepub unsafe fn from_ptr<'a>(buf: *const u8) -> Result<RawEvent<'a>>
pub unsafe fn from_ptr<'a>(buf: *const u8) -> Result<RawEvent<'a>>
§Safety
buf
must point to a complete event, i.e.
- include the length field
- include
nparams
lengths - have enough data bytes for all the fields (sum of lengths)
pub fn load<'a, T: PayloadFromBytes<'a> + EventPayload>( &'a self, ) -> Result<Event<T>, PayloadFromBytesError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for RawEvent<'a>
impl<'a> RefUnwindSafe for RawEvent<'a>
impl<'a> Send for RawEvent<'a>
impl<'a> Sync for RawEvent<'a>
impl<'a> Unpin for RawEvent<'a>
impl<'a> UnwindSafe for RawEvent<'a>
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