MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus-components / sync_item

Function sync_item

primitives/src/collection.rs:613–622  ·  view source on GitHub ↗
(items: &mut Vec<CollectionItemState>, item: CollectionItemState)

Source from the content-addressed store, hash-verified

611}
612
613fn sync_item(items: &mut Vec<CollectionItemState>, item: CollectionItemState) {
614 if let Some(position) = items
615 .iter()
616 .position(|existing| existing.same_identity(&item))
617 {
618 items.remove(position);
619 }
620 let insert_at = items.partition_point(|existing| existing.index <= item.index);
621 items.insert(insert_at, item);
622}
623
624fn next_index_after(indices: &[usize], current: Option<usize>, roving_loop: bool) -> Option<usize> {
625 match current {

Callers 1

register_itemMethod · 0.85

Calls 3

iterMethod · 0.80
same_identityMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected