pub unsafe trait InteropType:
Any
+ Send
+ Sync {
const TYPE_NAME: &'static str;
}Expand description
A Rust type with an explicitly declared cross-language representation.
Implementing this trait promises that values of Self have the ABI layout expected by the
foreign code that uses Self::TYPE_NAME. Packet::from_interop hashes that stable name
and stores the value behind a foreign-readable pointer.
§Safety
The implementation must guarantee that:
Selfhas the same size, alignment and field layout as the foreign type registered underTYPE_NAME(normally use#[repr(C)]);- foreign readers treat the pointer as immutable and do not retain it beyond the packet’s lifetime;
TYPE_NAMEis stable and uniquely identifies that layout across all participating binaries.
Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".