pub struct MessageHeader {
pub version: Version,
pub flags: Flags,
pub message_type: MessageType,
pub message_size: u32,
}Expand description
GIOP message header (spec §15.4.1).
Fields§
§version: VersionGIOP version (spec §15.4.1).
flags: FlagsFlags octet (in GIOP 1.0 only byte_order).
message_type: MessageTypeMessage-type discriminant.
message_size: u32message_size — body size in bytes (excluding the header).
Implementations§
Source§impl MessageHeader
impl MessageHeader
Sourcepub const fn new(
version: Version,
flags: Flags,
message_type: MessageType,
message_size: u32,
) -> Self
pub const fn new( version: Version, flags: Flags, message_type: MessageType, message_size: u32, ) -> Self
Constructor.
Sourcepub const fn endianness(&self) -> Endianness
pub const fn endianness(&self) -> Endianness
Returns the endianness from the flags octet (bit 0).
Sourcepub fn encode(&self, w: &mut BufferWriter) -> GiopResult<()>
pub fn encode(&self, w: &mut BufferWriter) -> GiopResult<()>
Sourcepub fn decode(bytes: &[u8]) -> GiopResult<(Self, &[u8])>
pub fn decode(bytes: &[u8]) -> GiopResult<(Self, &[u8])>
Decodes the 12-byte header.
Important: the caller must create the BufferReader with
Endianness::Big — the first 8 bytes
(magic+version+flags+msg_type) are endian-free, but the
message_size u32 must be re-interpreted based on the flags
byte. This helper reads the flags byte and flips the endianness
if necessary.
§Errors
InvalidMagicif bytes 0..4 are not"GIOP".UnsupportedVersionif major/minor is none of 1.0/1.1/1.2.UnknownMessageTypeif the octet is not in 0..=7.- Buffer read error.
Trait Implementations§
Source§impl Clone for MessageHeader
impl Clone for MessageHeader
Source§fn clone(&self) -> MessageHeader
fn clone(&self) -> MessageHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MessageHeader
Source§impl Debug for MessageHeader
impl Debug for MessageHeader
impl Eq for MessageHeader
Source§impl PartialEq for MessageHeader
impl PartialEq for MessageHeader
Source§fn eq(&self, other: &MessageHeader) -> bool
fn eq(&self, other: &MessageHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MessageHeader
Auto Trait Implementations§
impl Freeze for MessageHeader
impl RefUnwindSafe for MessageHeader
impl Send for MessageHeader
impl Sync for MessageHeader
impl Unpin for MessageHeader
impl UnsafeUnpin for MessageHeader
impl UnwindSafe for MessageHeader
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