pub trait ToOffset: PartialOrd {
// Required method
fn to_offset(self, length: usize) -> usize;
}
Expand description
Trait to allow the main signed and unsigned integer types where negative values are treated as offsets from the end, defined by length -1 == length -1, 0 == start, 1 == second position If the offset underflows, it returns 0. If it overflows, it returns the last index for arrays or the length for integer types.
Required 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.