Enum linux_perf_event_reader::RawData
source · Expand description
A slice of u8 data that can have non-contiguous backing storage split into two pieces, and abstracts that split away so that users can pretend to deal with a contiguous slice.
When reading perf events from the mmap’d fd that contains the perf event stream, it often happens that a single record straddles the boundary between two mmap chunks, or is wrapped from the end to the start of a chunk.
Variants§
Implementations§
source§impl<'a> RawData<'a>
impl<'a> RawData<'a>
pub fn empty() -> Self
pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
pub fn read_u64<T: ByteOrder>(&mut self) -> Result<u64, Error>
pub fn read_u32<T: ByteOrder>(&mut self) -> Result<u32, Error>
pub fn read_i32<T: ByteOrder>(&mut self) -> Result<i32, Error>
pub fn read_u16<T: ByteOrder>(&mut self) -> Result<u16, Error>
pub fn read_u8(&mut self) -> Result<u8, Error>
sourcepub fn read_string(&mut self) -> Option<RawData<'a>>
pub fn read_string(&mut self) -> Option<RawData<'a>>
Finds the first nul byte. Returns everything before that nul byte. Sets self to everything after the nul byte.
sourcepub fn split_off_prefix(&mut self, n: usize) -> Result<Self, Error>
pub fn split_off_prefix(&mut self, n: usize) -> Result<Self, Error>
Returns the first n
bytes, and sets self to the remainder.