gcore::msg

Function read_at

Source
pub fn read_at(offset: usize, buffer: &mut [u8]) -> Result<()>
Expand description

Get a payload of the message that is currently being processed, starting from some particular offset.

Note that part of a buffer can be left untouched by this function, if message payload does not have enough data.

ยงExamples

use gcore::msg;

#[unsafe(no_mangle)]
extern "C" fn handle() {
    let mut payload = vec![0u8; msg::size() - 16];
    msg::read_at(16, &mut payload).expect("Unable to read");
}