Skip to main content

EndianSwap

Trait EndianSwap 

Source
pub trait EndianSwap {
    // Required method
    unsafe fn endian_swap(&mut self, to_net: bool);
}
Expand description

Trait used by generated message types that require endian conversions.

Implementations should swap fields between host and network byte order.

Required Methods§

Source

unsafe fn endian_swap(&mut self, to_net: bool)

Swap the endianness of the message in-place.

to_net == true indicates conversion from host to network order.

§Safety

The caller must ensure that if self contains a variable length array that elements indexed from 0 up to the contents of the length field are initialised and contained within the memory allocated for the object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§