ferroui_base/collections/
i_ferro_list.rs1use super::{FerroList, IFerroReadOnlyList};
2
3pub trait IFerroList<T>: IFerroReadOnlyList<T> {
9 fn set(&self, index: usize, value: T);
11
12 fn add(&self, item: T);
14
15 fn insert(&self, index: usize, item: T);
17
18 fn remove_at(&self, index: usize);
20
21 fn clear(&self);
23
24 fn contains(&self, item: &T) -> bool;
26
27 fn index_of(&self, item: &T) -> Option<usize>;
29
30 fn remove(&self, item: &T) -> bool;
32
33 fn add_range(&self, items: Vec<T>);
35
36 fn insert_range(&self, index: usize, items: Vec<T>);
38
39 fn move_item(&self, old_index: usize, new_index: usize);
41
42 fn move_range(&self, old_index: usize, count: usize, new_index: usize);
44
45 fn remove_all(&self, items: Vec<T>);
47
48 fn remove_range(&self, index: usize, count: usize);
50}
51
52impl<T: Clone + PartialEq> IFerroList<T> for FerroList<T> {
53 fn set(&self, index: usize, value: T) {
54 FerroList::set(self, index, value)
55 }
56
57 fn add(&self, item: T) {
58 FerroList::add(self, item)
59 }
60
61 fn insert(&self, index: usize, item: T) {
62 FerroList::insert(self, index, item)
63 }
64
65 fn remove_at(&self, index: usize) {
66 FerroList::remove_at(self, index)
67 }
68
69 fn clear(&self) {
70 FerroList::clear(self)
71 }
72
73 fn contains(&self, item: &T) -> bool {
74 FerroList::contains(self, item)
75 }
76
77 fn index_of(&self, item: &T) -> Option<usize> {
78 FerroList::index_of(self, item)
79 }
80
81 fn remove(&self, item: &T) -> bool {
82 FerroList::remove(self, item)
83 }
84
85 fn add_range(&self, items: Vec<T>) {
86 FerroList::add_range(self, items)
87 }
88
89 fn insert_range(&self, index: usize, items: Vec<T>) {
90 FerroList::insert_range(self, index, items)
91 }
92
93 fn move_item(&self, old_index: usize, new_index: usize) {
94 FerroList::move_item(self, old_index, new_index)
95 }
96
97 fn move_range(&self, old_index: usize, count: usize, new_index: usize) {
98 FerroList::move_range(self, old_index, count, new_index)
99 }
100
101 fn remove_all(&self, items: Vec<T>) {
102 FerroList::remove_all(self, items)
103 }
104
105 fn remove_range(&self, index: usize, count: usize) {
106 FerroList::remove_range(self, index, count)
107 }
108}