Skip to main content

PlainType

Trait PlainType 

Source
pub unsafe trait PlainType:
    Copy
    + Send
    + Sync
    + 'static { }
Expand description

A type whose samples can be loaned: one of a fixed size, whose value in memory is its serialized form.

§Safety

The type must be plain data: #[repr(C)] (or a primitive, or an array of such), with no pointers or references, valid when all its octets are zero, and valid for any octets that a value of it holds, since a reader of another process takes the octets of a writer’s sample as a value. Its layout must be its serialized form (after the 4-octet encapsulation) in the writer’s data representation and the host’s byte order: the members in order, each aligned as the representation aligns it (to its size in XCDR1, to at most 4 in XCDR2). A writer checks this on its first loaned sample, and copies the samples it lends when it does not hold.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PlainType for f32

Source§

impl PlainType for f64

Source§

impl PlainType for i8

Source§

impl PlainType for i16

Source§

impl PlainType for i32

Source§

impl PlainType for i64

Source§

impl PlainType for u8

Source§

impl PlainType for u16

Source§

impl PlainType for u32

Source§

impl PlainType for u64

Source§

impl<T: PlainType, const N: usize> PlainType for [T; N]

Implementors§