pub struct ActionCollection(/* private fields */);Expand description
Represents a collection of IActions.
The collection is a notifying list of objects (FerroList<FerroObject>); every item must be
an action. It is a reference object: clones refer to the same collection and compare by
identity.
Implementations§
Source§impl ActionCollection
impl ActionCollection
Sourcepub fn new() -> Self
pub fn new() -> Self
Initializes a new instance of the ActionCollection class.
Sourcepub fn list(&self) -> &FerroList<Ref<FerroObject>>
pub fn list(&self) -> &FerroList<Ref<FerroObject>>
The list of the collection.
Methods from Deref<Target = FerroList<Ref<FerroObject>>>§
Sourcepub fn add_collection_changed(
&self,
handler: Rc<dyn for<'a> Fn(&NotifyCollectionChangedEventArgs<'a, T>)>,
) -> u64
pub fn add_collection_changed( &self, handler: Rc<dyn for<'a> Fn(&NotifyCollectionChangedEventArgs<'a, T>)>, ) -> u64
Subscribes to changes. Returns a token for
remove_collection_changed.
Sourcepub fn remove_collection_changed(&self, token: u64) -> bool
pub fn remove_collection_changed(&self, token: u64) -> bool
Unsubscribes a handler.
Sourcepub fn has_collection_changed_subscribers(&self) -> bool
pub fn has_collection_changed_subscribers(&self) -> bool
Whether anything is subscribed to changes, typed or untyped.
pub fn is_empty(&self) -> bool
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
The number of items the list can hold before its storage grows.
Sourcepub fn set_capacity(&self, capacity: usize)
pub fn set_capacity(&self, capacity: usize)
Sets the number of items the list can hold before its storage grows.
§Panics
Panics if capacity is less than the number of items, as the
managed original throws.
Sourcepub fn reset_behavior(&self) -> ResetBehavior
pub fn reset_behavior(&self) -> ResetBehavior
The reset behavior of the list.
pub fn set_reset_behavior(&self, value: ResetBehavior)
Sourcepub fn validate(&self) -> Option<Rc<dyn Fn(&T)>>where
T: 'static,
pub fn validate(&self) -> Option<Rc<dyn Fn(&T)>>where
T: 'static,
The validation routine that is invoked for every item before it is added to the list.
Sourcepub fn set_validate(&self, value: Option<Rc<dyn Fn(&T)>>)where
T: 'static,
pub fn set_validate(&self, value: Option<Rc<dyn Fn(&T)>>)where
T: 'static,
Sets a validation routine that is invoked for every item before it is added to the list; it rejects an item by panicking.
Sourcepub fn validator(&self) -> Option<Rc<dyn IFerroListItemValidator<T>>>where
T: 'static,
pub fn validator(&self) -> Option<Rc<dyn IFerroListItemValidator<T>>>where
T: 'static,
The validator that is invoked for every item before it is added to the list.
pub fn set_validator(&self, value: Option<Rc<dyn IFerroListItemValidator<T>>>)
Sourcepub fn snapshot(&self) -> Rc<Vec<T>>
pub fn snapshot(&self) -> Rc<Vec<T>>
A snapshot of the items. It stays valid and unchanged if the list is modified.
Sourcepub fn add_range(&self, items: impl IntoIterator<Item = T>)
pub fn add_range(&self, items: impl IntoIterator<Item = T>)
Adds multiple items to the collection.
Sourcepub fn insert_range(&self, index: usize, items: impl IntoIterator<Item = T>)
pub fn insert_range(&self, index: usize, items: impl IntoIterator<Item = T>)
Inserts multiple items at the specified index.
Sourcepub fn move_range(&self, old_index: usize, count: usize, new_index: usize)
pub fn move_range(&self, old_index: usize, count: usize, new_index: usize)
Moves multiple items to a new index.
Sourcepub fn remove_range(&self, index: usize, count: usize)
pub fn remove_range(&self, index: usize, count: usize)
Removes a range of elements from the collection.
Sourcepub fn copy_to(&self, array: &mut [T], array_index: usize)
pub fn copy_to(&self, array: &mut [T], array_index: usize)
Copies the items into array, starting at array_index.
§Panics
Panics if array is too small, as the managed original throws.
Sourcepub fn get_range(&self, index: usize, count: usize) -> Vec<T>
pub fn get_range(&self, index: usize, count: usize) -> Vec<T>
Gets a range of items from the collection.
Sourcepub fn ensure_capacity(&self, capacity: usize)
pub fn ensure_capacity(&self, capacity: usize)
Ensures that the capacity of the list is at least capacity.
Sourcepub fn remove(&self, item: &T) -> bool
pub fn remove(&self, item: &T) -> bool
Removes an item from the collection. Returns true if it was present.
Sourcepub fn remove_all(&self, items: impl IntoIterator<Item = T>)
pub fn remove_all(&self, items: impl IntoIterator<Item = T>)
Removes multiple items from the collection.
Each run of adjacent items that are removed is notified as one removal, from the end of the list to its start.
Trait Implementations§
Source§impl Clone for ActionCollection
impl Clone for ActionCollection
Source§impl Debug for ActionCollection
impl Debug for ActionCollection
Source§impl Default for ActionCollection
impl Default for ActionCollection
Source§impl Deref for ActionCollection
impl Deref for ActionCollection
Source§impl MarkupTyped for ActionCollection
impl MarkupTyped for ActionCollection
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Source§impl PartialEq for ActionCollection
impl PartialEq for ActionCollection
impl StructuralPartialEq for ActionCollection
Auto Trait Implementations§
impl !RefUnwindSafe for ActionCollection
impl !Send for ActionCollection
impl !Sync for ActionCollection
impl !UnwindSafe for ActionCollection
impl Freeze for ActionCollection
impl Unpin for ActionCollection
impl UnsafeUnpin for ActionCollection
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more