IndexRange
struct · ferroui-controls · v0.5.0
struct IndexRange
An inclusive range of indexes.
The arithmetic wraps on overflow, as the managed implementation's does:
"select all" without a source selects the range 0..=i32::MAX.
Members
from_indexnewbeginendcountcontainssplitintersectsadjacentcontains_inget_ataddadd_rangesintersectremoveremove_rangesenumerate_indicesget_count
from_index
fn from_index(index: i32) -> Self
A range holding a single index.
new
fn new(begin: i32, end: i32) -> Self
begin
fn begin(self: &Self) -> i32
end
fn end(self: &Self) -> i32
count
fn count(self: &Self) -> i32
contains
fn contains(self: &Self, index: i32) -> bool
split
fn split(self: &Self, split_index: i32) -> (IndexRange, Option<IndexRange>)
Splits the range after split_index: the part up to and including
the index, and the part after it if there is one.
intersects
fn intersects(self: &Self, other: IndexRange) -> bool
adjacent
fn adjacent(self: &Self, other: IndexRange) -> bool
contains_in
fn contains_in(ranges: Option<&[IndexRange]>, index: i32) -> bool
Whether any of the ranges contains the index.
get_at
fn get_at(ranges: &[IndexRange], index: i32) -> i32
The indexth index of the ranges.
add
fn add(ranges: &mut Vec<IndexRange>, range: IndexRange, added: Option<&mut Vec<IndexRange>>) -> i32
Adds a range to the ranges. Returns the number of indexes added,
which are recorded in added.
add_ranges
fn add_ranges(destination: &mut Vec<IndexRange>, source: &[IndexRange], added: Option<&mut Vec<IndexRange>>) -> i32
Adds each of the source ranges to destination.
intersect
fn intersect(ranges: &mut Vec<IndexRange>, range: IndexRange, removed: Option<&mut Vec<IndexRange>>) -> i32
Restricts the ranges to range. Returns the number of indexes
removed, which are recorded in removed.
remove
fn remove(ranges: Option<&mut Vec<IndexRange>>, range: IndexRange, removed: Option<&mut Vec<IndexRange>>) -> i32
Removes a range from the ranges. Returns the number of indexes
removed, which are recorded in removed.
remove_ranges
fn remove_ranges(destination: &mut Vec<IndexRange>, source: &[IndexRange], added: Option<&mut Vec<IndexRange>>) -> i32
Removes each of the source ranges from destination.
enumerate_indices
fn enumerate_indices(ranges: Rc<Vec<IndexRange>>) -> IndexRangeIndices
Enumerates the indexes of the ranges.
get_count
fn get_count(ranges: &[IndexRange]) -> i32
The number of indexes in the ranges.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringResourceKeyObjectPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherCloneCopyDebugStructuralPartialEqPartialEqEqHashDisplay
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.