pub unsafe trait Element:
Send
+ Sync
+ 'static {
type Ref<'a>: Copy + Debug;
type Spans: Spans;
const INLINE_FIXED: bool;
// Required methods
fn validate(bytes: &[u8]) -> bool;
unsafe fn read<'a>(ptr: *const u8, len: usize) -> Self::Ref<'a>
where Self: 'a;
// Provided method
fn fmt_row<'a, I>(values: I, f: &mut Formatter<'_>) -> Result
where I: Iterator<Item = Self::Ref<'a>>,
Self: 'a { ... }
}Expand description
A type of the values a Buf holds: where they are in its storage, see Spans, and
what octets are one of them.
This is implemented for every PackedElement, and for str, whose values are at
the spans of a table.
§Safety
Self::read must be sound for any octets Self::validate accepts.
Required Associated Constants§
Sourceconst INLINE_FIXED: bool
const INLINE_FIXED: bool
Whether a scalar of this type is held in place of a storage, which only a packed type small enough can be.
Required Associated Types§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".