fidl_next/protocol/
wire.rsuse crate::{u32_le, u64_le, Decode, DecodeError, Encodable, Encode, EncodeError, IntoBytes, Slot};
#[derive(Clone, Copy, Debug, IntoBytes)]
#[repr(C)]
pub struct WireMessageHeader {
pub txid: u32_le,
pub flags: [u8; 3],
pub magic_number: u8,
pub ordinal: u64_le,
}
pub const FLAG_0_WIRE_FORMAT_V2_BIT: u8 = 0b0000_0010;
pub const MAGIC_NUMBER: u8 = 0x01;
impl Encodable for WireMessageHeader {
type Encoded<'buf> = WireMessageHeader;
}
impl<E: ?Sized> Encode<E> for WireMessageHeader {
#[inline]
fn encode(
&mut self,
_: &mut E,
mut slot: Slot<'_, Self::Encoded<'_>>,
) -> Result<(), EncodeError> {
slot.write(*self);
Ok(())
}
}
unsafe impl<D: ?Sized> Decode<D> for WireMessageHeader {
#[inline]
fn decode(_: Slot<'_, Self>, _: &mut D) -> Result<(), DecodeError> {
Ok(())
}
}