pub trait Segment {
// Required methods
fn number_of_bytes(&self) -> usize;
fn empty() -> Self;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Some sort of segment that knows its length (in bytes). It’s used for constructing binaries/strings efficiently (knowing the entire length in advance to avoid re-allocations).
Required Methods§
Sourcefn number_of_bytes(&self) -> usize
fn number_of_bytes(&self) -> usize
The number of bytes in this segment.
Provided Methods§
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.