pub unsafe trait PackedElement: Element<Spans = PackedSpans<Self>> + Copy {
// Required method
fn validate_all(bytes: &[u8]) -> bool;
}Expand description
An element whose values are packed as their octets, one after the other, which is what
allows a Buf of them to be seen as a slice, see Buf::as_slice, and written, see
BufMut.
§Safety
The type must have no padding and not be zero-sized, its values must be exactly the
octets Self::validate_all accepts, read as they are, and octets that are all zeroes
must be a valid value, which is what new room in a storage holds.
Required Methods§
Sourcefn validate_all(bytes: &[u8]) -> bool
fn validate_all(bytes: &[u8]) -> bool
Whether the octets of a whole number of consecutive values are all valid values,
in a single pass: what octets are checked with when they are cast, and what
Element::validate is for one value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".