/// A trait for plain data types that can be safely read from a byte slice. /// /// A type can be [`Plain`](trait.Plain.html) if it is `#repr(C)` and only contains /// data with no possible invalid values. Types that _can't_ be `Plain` /// include, but are not limited to, `bool`, `char`, `enum`s, tuples, /// pointers and references. /// /// At this moment, `Drop` types are also not legal, because /// compiler adds a special "drop flag" into the type. This is slated /// to change in the future. /// /// On the other hand, arrays of a `Plain` type, and /// structures where all members are plain (and not `Drop`), are okay. /// /// Structures that are not `#repr(C)`, while not necessarily illegal /// in principle, are largely useless because they don't have a stable /// layout. For example, the compiler is allowed to reorder fields /// arbitrarily. /// /// All methods of this trait are implemented automatically as wrappers /// for crate-level funtions. /// pubunsafetrait Plain { #[inline(always)] fn from_bytes(bytes: &[u8]) -> Result<&Self, Error> where Self: Sized,
{
::from_bytes(bytes)
}
unsafeimpl Plain for u8 {} unsafeimpl Plain for u16 {} unsafeimpl Plain for u32 {} unsafeimpl Plain for u64 {} unsafeimpl Plain for usize {}
unsafeimpl Plain for i8 {} unsafeimpl Plain for i16 {} unsafeimpl Plain for i32 {} unsafeimpl Plain for i64 {} unsafeimpl Plain for isize {}
unsafeimpl<S> Plain for [S] where
S: Plain,
{
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.