FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    IndexPath

    struct · ferroui-treedatagrid-core · v0.5.0

    struct IndexPath
    

    A path of indexes into a hierarchy: one index for a row of a flat source or a root row, one more per level below. The empty path (IndexPath::UNSELECTED, the default) is no row.

    As the reference, a path of one index is stored without an allocation (_index is the index plus one, 0 for the empty path); longer paths share an immutable array.

    View source

    Members

    UNSELECTED

    const UNSELECTED: IndexPath
    

    The empty path.

    Source

    new

    fn new(index: i32) -> Self
    

    The path of one index.

    Source

    from_indexes

    fn from_indexes(indexes: &[i32]) -> Self
    

    The path of the given indexes (params int[]), stored as an array even when it has one index or none, as the reference's constructor does.

    Source

    from_iter_opt

    fn from_iter_opt(indexes: Option<impl IntoIterator<Item = i32>>) -> Self
    

    The path of the given indexes, or the empty path for None (IndexPath(IEnumerable<int>?)).

    Source

    encoded_index

    fn encoded_index(self: &Self) -> i32
    

    The encoded index (the index plus one; 0 for a path that is an array or empty), shared with the presentation so that virtualization does not allocate paths.

    Source

    path

    fn path(self: &Self) -> Option<&Rc<[i32]>>
    

    The array of a path of more than one index (or of a path built from an array).

    Source

    from_encoded

    fn from_encoded(encoded_index: i32, path: Option<Rc<[i32]>>) -> Self
    

    A path from its encoded parts (encoded_index, path).

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of indexes.

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Whether the path is empty (no row).

    Source

    get

    fn get(self: &Self, index: usize) -> i32
    

    The index at index.

    Panics

    When index is not below count (IndexOutOfRangeException).

    Source

    last

    fn last(self: &Self) -> i32
    

    The last index (index[^1]).

    Panics

    For the empty path.

    Source

    parent

    fn parent(self: &Self) -> IndexPath
    

    The path without its last index (index[..^1]); the empty path for a path of one index.

    Panics

    For the empty path.

    Source

    append

    fn append(self: &Self, child_index: i32) -> IndexPath
    

    The path with child_index appended.

    Panics

    When child_index is negative (ArgumentException).

    Source

    is_ancestor_of

    fn is_ancestor_of(self: &Self, other: &IndexPath) -> bool
    

    Whether this path is an ancestor of other: a shorter prefix of it.

    Source

    is_parent_of

    fn is_parent_of(self: &Self, other: &IndexPath) -> bool
    

    Whether this path is the parent of other: its prefix one shorter.

    Source

    slice

    fn slice(self: &Self, start: usize, length: usize) -> IndexPath
    

    The length indexes from start.

    Panics

    When the range is not within the path (IndexOutOfRangeException).

    Source

    to_vec

    fn to_vec(self: &Self) -> Vec<i32>
    

    The indexes as a vector.

    Source

    iter

    fn iter(self: &Self) -> impl Iterator<Item = i32> + '_
    

    The indexes.

    Source

    compare

    fn compare(self: &Self, other: &IndexPath) -> Ordering
    

    CompareTo: by index, a prefix before the longer path; an empty path before a non-empty one.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.