Message

Trait Message 

Source
pub trait Message: Sized {
    // Required methods
    fn message_type() -> &'static str;
    fn encode_content(&self) -> Result<Vec<u8>>;
    fn decode_content(data: &[u8]) -> Result<Self>;
}
Expand description

Common interface for all OpenIGTLink message types

Each message type (TRANSFORM, IMAGE, STATUS, etc.) must implement this trait to provide encoding/decoding functionality.

Required Methods§

Source

fn message_type() -> &'static str

Returns the message type name (e.g., “TRANSFORM”, “IMAGE”)

This must match the OpenIGTLink protocol specification.

Source

fn encode_content(&self) -> Result<Vec<u8>>

Encode message content to bytes

§Returns

Byte vector containing the encoded message content (without header)

Source

fn decode_content(data: &[u8]) -> Result<Self>

Decode message content from bytes

§Arguments
  • data - Byte slice containing the message content (without header)
§Returns

Decoded message or error

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§