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 Box<dyn UiNodeBoxed>, &mut Box<dyn UiNodeBoxed>) -> Ordering + Send + 'static,
) -> SortingList
pub fn new( list: impl UiNodeList, sort: impl Fn(&mut Box<dyn UiNodeBoxed>, &mut Box<dyn UiNodeBoxed>) -> Ordering + Send + 'static, ) -> SortingList
New from list and sort function.
sourcepub fn list(&mut self) -> &mut Box<dyn UiNodeListBoxed>
pub fn list(&mut self) -> &mut Box<dyn UiNodeListBoxed>
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 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 drain_into(&mut self, vec: &mut Vec<Box<dyn UiNodeBoxed>>)
fn drain_into(&mut self, vec: &mut Vec<Box<dyn UiNodeBoxed>>)
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,
) -> Size2D<Px, Px>
fn measure_each<F, S>( &mut self, wm: &mut WidgetMeasure, measure: F, fold_size: S, ) -> Size2D<Px, Px>
source§fn layout_each<F, S>(
&mut self,
wl: &mut WidgetLayout,
layout: F,
fold_size: S,
) -> Size2D<Px, Px>
fn layout_each<F, S>( &mut self, wl: &mut WidgetLayout, layout: F, fold_size: S, ) -> Size2D<Px, Px>
source§fn downcast_unbox<L>(self) -> Result<L, Box<dyn UiNodeListBoxed>>where
L: UiNodeList,
Self: Sized,
fn downcast_unbox<L>(self) -> Result<L, Box<dyn UiNodeListBoxed>>where
L: UiNodeList,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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