Struct zng_app::widget::node::SortingList
source · pub struct SortingList { /* private fields */ }
Expand description
Represents a sorted view into an UiNodeList
.
The underlying list is not changed, a sorted index map is used to iterate the underlying list.
Note that the *_all
methods are not sorted, only the other accessors map to the sorted position of nodes. The sorting is lazy
and gets invalidated on every init and every time there are changes observed in update_all
.
Implementations§
source§impl SortingList
impl SortingList
sourcepub fn new(
list: impl UiNodeList,
sort: impl Fn(&mut BoxedUiNode, &mut BoxedUiNode) -> Ordering + Send + 'static,
) -> Self
pub fn new( list: impl UiNodeList, sort: impl Fn(&mut BoxedUiNode, &mut BoxedUiNode) -> Ordering + Send + 'static, ) -> Self
New from list and sort function.
sourcepub fn list(&mut self) -> &mut BoxedUiNodeList
pub fn list(&mut self) -> &mut BoxedUiNodeList
Mutable borrow the inner list.
You must call invalidate_sort
if any modification is done to the list.
sourcepub fn invalidate_sort(&mut self)
pub fn invalidate_sort(&mut self)
Invalidate the sort, the list will resort on the nest time the sorted positions are needed.
Note that you can also invalidate sort from the inside using SORTING_LIST::invalidate_sort
.
Trait Implementations§
source§impl UiNodeList for SortingList
impl UiNodeList for SortingList
source§fn with_node<R, F>(&mut self, index: usize, f: F) -> Rwhere
F: FnOnce(&mut BoxedUiNode) -> R,
fn with_node<R, F>(&mut self, index: usize, f: F) -> Rwhere
F: FnOnce(&mut BoxedUiNode) -> R,
Visit the specific node. Read more
source§fn for_each<F>(&mut self, f: F)
fn for_each<F>(&mut self, f: F)
Calls
f
for each node in the list with the index, sequentially.source§fn par_each<F>(&mut self, f: F)
fn par_each<F>(&mut self, f: F)
Calls
f
for each node in the list with the index, in parallel.source§fn par_fold_reduce<T, I, F, R>(&mut self, identity: I, fold: F, _: R) -> T
fn par_fold_reduce<T, I, F, R>(&mut self, identity: I, fold: F, _: R) -> T
Calls
fold
for each node in the list in parallel, with fold accumulators produced by identity
, then merges the folded results
using reduce
to produce the final value also in parallel. Read moresource§fn boxed(self) -> BoxedUiNodeList
fn boxed(self) -> BoxedUiNodeList
Gets
self
boxed, or itself if it is already boxed.source§fn drain_into(&mut self, vec: &mut Vec<BoxedUiNode>)
fn drain_into(&mut self, vec: &mut Vec<BoxedUiNode>)
Move all nodes into
vec
.source§fn deinit_all(&mut self)
fn deinit_all(&mut self)
Deinit the list in a context, all nodes are also deinited. Read more
source§fn info_all(&mut self, info: &mut WidgetInfoBuilder)
fn info_all(&mut self, info: &mut WidgetInfoBuilder)
Rebuilds the list in a context, all node info is rebuilt.
source§fn event_all(&mut self, update: &EventUpdate)
fn event_all(&mut self, update: &EventUpdate)
Receive an event for the list in a context, all nodes are also notified. Read more
source§fn update_all(
&mut self,
updates: &WidgetUpdates,
observer: &mut dyn UiNodeListObserver,
)
fn update_all( &mut self, updates: &WidgetUpdates, observer: &mut dyn UiNodeListObserver, )
Receive updates for the list in a context, all nodes are also updated. Read more
source§fn render_all(&mut self, frame: &mut FrameBuilder)
fn render_all(&mut self, frame: &mut FrameBuilder)
Render all nodes. Read more
source§fn render_update_all(&mut self, update: &mut FrameUpdate)
fn render_update_all(&mut self, update: &mut FrameUpdate)
Render all nodes. Read more
source§fn measure_each<F, S>(
&mut self,
wm: &mut WidgetMeasure,
measure: F,
fold_size: S,
) -> PxSize
fn measure_each<F, S>( &mut self, wm: &mut WidgetMeasure, measure: F, fold_size: S, ) -> PxSize
source§fn layout_each<F, S>(
&mut self,
wl: &mut WidgetLayout,
layout: F,
fold_size: S,
) -> PxSize
fn layout_each<F, S>( &mut self, wl: &mut WidgetLayout, layout: F, fold_size: S, ) -> PxSize
source§fn downcast_unbox<L: UiNodeList>(self) -> Result<L, BoxedUiNodeList>where
Self: Sized,
fn downcast_unbox<L: UiNodeList>(self) -> Result<L, BoxedUiNodeList>where
Self: Sized,
source§fn actual_type_id(&self) -> TypeId
fn actual_type_id(&self) -> TypeId
Returns the
type_id
of the unboxed list.Auto Trait Implementations§
impl Freeze for SortingList
impl !RefUnwindSafe for SortingList
impl Send for SortingList
impl !Sync for SortingList
impl Unpin for SortingList
impl !UnwindSafe for SortingList
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more