pub trait RangeExt<T> {
// Required methods
fn is_valid(&self) -> bool;
fn length(&self) -> Result<T, Error>;
fn is_aligned(&self, block_size: impl Into<T>) -> bool;
fn split(self, split_point: T) -> (Option<Range<T>>, Option<Range<T>>);
}
Required Methods§
Sourcefn length(&self) -> Result<T, Error>
fn length(&self) -> Result<T, Error>
Returns the length of the range, or an error if the range is !RangeExt::is_valid()
.
Since this is intended to be used primarily for possibly-untrusted serialized ranges, the
error returned is FxfsError::Inconsistent.
Sourcefn is_aligned(&self, block_size: impl Into<T>) -> bool
fn is_aligned(&self, block_size: impl Into<T>) -> bool
Returns true if the range is aligned to the given block size.
Sourcefn split(self, split_point: T) -> (Option<Range<T>>, Option<Range<T>>)
fn split(self, split_point: T) -> (Option<Range<T>>, Option<Range<T>>)
Splits the half-open range [range.start, range.end)
into the ranges [range.start, split_point)
and [split_point, range.end)
. If either of the new ranges would be empty,
then None
is returned in its place and Some(range)
is returned for the other. range
must not be empty.
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.