FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RealizedStackElements

    struct · ferroui-controls-treedatagrid · v0.5.0

    struct RealizedStackElements
    

    Stores the realized element state for a presenter of the control.

    The state is interior-mutable: the methods that call back into the presenter (to recycle an element or to update its index) never hold a borrow of the element list across the callback.

    View source

    Members

    new

    fn new(trace_enabled: bool) -> Self
    

    Source

    count

    fn count(self: &Self) -> usize
    

    Gets the number of realized elements.

    Source

    first_index

    fn first_index(self: &Self) -> i32
    

    Gets the index of the first realized element, or -1 if no elements are realized.

    Source

    last_index

    fn last_index(self: &Self) -> i32
    

    Gets the index of the last realized element, or -1 if no elements are realized.

    Source

    elements

    fn elements(self: &Self) -> CellRef<'_, Vec<Option<Ref<Control>>>>
    

    Gets the elements.

    The returned borrow must not be held across a call that can run code outside the presenter; use element_at for that.

    Source

    elements_snapshot

    fn elements_snapshot(self: &Self) -> Vec<Option<Ref<Control>>>
    

    A copy of the elements.

    Source

    size_u

    fn size_u(self: &Self) -> CellRef<'_, Vec<f64>>
    

    Gets the sizes of the elements on the primary axis.

    Source

    element_at

    fn element_at(self: &Self, i: usize) -> Option<Ref<Control>>
    

    Gets the element at the specified position of the realized list (not of the source collection), if there is one.

    Source

    size_u_at

    fn size_u_at(self: &Self, i: usize) -> f64
    

    Gets the size on the primary axis of the element at the specified position of the realized list (not of the source collection).

    Source

    start_u

    fn start_u(self: &Self) -> f64
    

    Gets the position of the first element on the primary axis.

    Source

    try_get_stable_range

    fn try_get_stable_range(self: &Self) -> Option<(f64, f64)>
    

    Gets the range covered by contiguous, measured realized elements, as (start, end).

    Source

    add

    fn add(self: &Self, index: i32, element: Ref<Control>, u: f64, size_u: f64)
    

    Adds a newly realized element to the collection.

    index is the index of the element, u the position of the element on the primary axis and size_u the size of the element on the primary axis.

    Source

    get_element

    fn get_element(self: &Self, index: i32) -> Option<Ref<Control>>
    

    Gets the element at the specified index, if realized.

    index is the index in the source collection of the element to get.

    Source

    get_or_estimate_anchor_element_for_viewport

    fn get_or_estimate_anchor_element_for_viewport(self: &Self, viewport_start_u: f64, viewport_end_u: f64, item_count: i32, estimated_element_size_u: &Cell<f64>) -> (i32, f64)
    

    Gets or estimates the index and start U position of the anchor element for the specified viewport.

    Returns the index of the anchor element, or -1 if an anchor could not be determined, and the U position of the start of the anchor element, if determined.

    This method tries to find an existing element in the specified viewport from which element realization can start. Failing that it estimates the first element in the viewport.

    Source

    get_element_u

    fn get_element_u(self: &Self, index: i32) -> f64
    

    Gets the position of the element with the requested index on the primary axis, if realized.

    Returns the position of the element, or NaN if the element is not realized.

    Source

    get_or_estimate_element_u

    fn get_or_estimate_element_u(self: &Self, index: i32, estimated_element_size_u: &Cell<f64>) -> f64
    

    Gets the position of the element with the requested index on the primary axis, estimating it from the realized range when the element is not realized.

    Source

    estimate_element_size_u

    fn estimate_element_size_u(self: &Self) -> f64
    

    Estimates the average U size of all elements in the source collection based on the realized elements.

    Returns the estimated U size of an element, or -1 if not enough information is present to make an estimate.

    Source

    get_index

    fn get_index(self: &Self, element: &Ref<Control>) -> i32
    

    Gets the index of the specified element.

    Returns the index or -1 if the element is not present in the collection.

    Source

    items_inserted

    fn items_inserted(self: &Self, index: i32, count: i32, update_element_index: impl Fn(&Ref<Control>, i32, i32) -> (), recycle_element: impl Fn(&Ref<Control>) -> ())
    

    Updates the elements in response to items being inserted into the source collection.

    index is the index in the source collection of the insert, count the number of items inserted, update_element_index a method used to update the element indexes and recycle_element a method used to recycle elements.

    Source

    items_removed

    fn items_removed(self: &Self, index: i32, count: i32, update_element_index: impl Fn(&Ref<Control>, i32, i32) -> (), recycle_element: impl Fn(&Ref<Control>) -> ())
    

    Updates the elements in response to items being removed from the source collection.

    index is the index in the source collection of the remove, count the number of items removed, update_element_index a method used to update the element indexes and recycle_element a method used to recycle elements.

    Source

    items_moved

    fn items_moved(self: &Self, old_index: i32, new_index: i32, count: i32, update_element_index: impl Fn(&Ref<Control>, i32, i32) -> (), recycle_element: impl Fn(&Ref<Control>) -> ())
    

    Updates the elements in response to items being moved within the source collection.

    old_index is the old index in the source collection, new_index the new index, count the number of items moved, update_element_index a method used to update the element indexes and recycle_element a method used to recycle elements.

    Source

    items_replaced

    fn items_replaced(self: &Self, index: i32, count: i32, recycle_element: impl Fn(&Ref<Control>) -> ())
    

    Updates the elements in response to items being replaced in the source collection.

    index is the index in the source collection of the remove, count the number of items removed and recycle_element a method used to recycle elements.

    Source

    items_reset

    fn items_reset(self: &Self, recycle_element: impl Fn(&Ref<Control>) -> ())
    

    Recycles all elements in response to the source collection being reset.

    recycle_element is a method used to recycle elements.

    Source

    recycle_elements_before

    fn recycle_elements_before(self: &Self, index: i32, recycle_element: impl Fn(&Ref<Control>, i32) -> ())
    

    Recycles elements before a specific index.

    index is the index in the source collection of new first element and recycle_element a method used to recycle elements.

    Source

    recycle_elements_after

    fn recycle_elements_after(self: &Self, index: i32, recycle_element: impl Fn(&Ref<Control>, i32) -> ())
    

    Recycles elements after a specific index.

    index is the index in the source collection of new last element and recycle_element a method used to recycle elements.

    Source

    recycle_all_elements

    fn recycle_all_elements(self: &Self, recycle_element: impl Fn(&Ref<Control>, i32) -> ())
    

    Recycles all realized elements.

    recycle_element is a method used to recycle elements.

    Source

    reset_for_reuse

    fn reset_for_reuse(self: &Self)
    

    Resets the element list and prepares it for reuse.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ClassDefaults
    • ErasedDestructor
    • IntoEither

    Availability

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