Skip to main content

decode_fixed

Function decode_fixed 

Source
pub fn decode_fixed<T: FromBytes + Immutable + KnownLayout>(
    msg: &IpcMessage,
) -> Option<&T>
Expand description

Try to decode a fixed-size repr(C) struct from an IpcMessage payload.

Returns None if:

  • T is larger than PAYLOAD_CAPACITY (size overflow), or
  • the payload slice is not correctly aligned for T (alignment mismatch).

§Example

use strat9_abi::ipc_codec::decode_fixed;

let msg: &IpcMessage = /* received message */;
if let Some(reply) = decode_fixed::<MyReply>(msg) {
    println!("status: {}", reply.status);
}