pub unsafe trait Flat:
FlatBase
+ FlatUnsized
+ FlatValidate { }Expand description
Flat type.
If you want to implement this type for your custom type it’s recommended to use safe #[flat] attribute macro instead.
§Safety
By implementing this trait by yourself you guarantee:
Selfhas stable binary representation that will not change in future. (But the representation could be differ across different platforms. If you need stronger guarantees consider usingPortabletypes.)Selfdon’t own any resources outside of it.Selfcould be trivially copied as bytes. (We cannot requireSelf:Copybecause it?Sized.)- All methods of dependent traits have proper implementation and will not cause an UB.
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.