Skip to main content

Crate range_check

Crate range_check 

Source
Expand description

Range checking and interval arithmetic utilities mirroring <kernel/range_check.h>.

Traits§

RangeExt
Extension trait providing range-checking methods directly on Range<T>.

Functions§

from_offset_len
Constructs a half-open Range<u64> from (offset, len).
from_offset_len_usize
Constructs a half-open Range<usize> from (offset, len).
get_intersect
Computes the intersection of two half-open ranges, returning Some(intersection) if they overlap, or None if they do not.
get_intersect_offset_len
Computes the intersection of two (offset, len) pairs, returning Some((offset, len)) if they overlap, or None if they do not.
in_range
Returns true if inner is fully contained inside outer.
in_range_max
Returns true if the range [offset, offset + len) is fully inside [0, max).
in_range_min_max
Returns true if the range [offset, offset + len) is fully inside [min, max).
intersects
Determines if two half-open ranges overlap.
intersects_offset_len
Determines if two (offset, len) pairs overlap as half-open ranges [offset, offset + len).
trim_range
Trims range so that it fits within 0..trim_to_len.
trim_range_offset_len
Trims [offset, offset + len) to [0, trim_to_len).