Skip to main content

DefinitionList

Struct DefinitionList 

Source
pub struct DefinitionList<T: ObjectType + Upcast<DefinitionBase>> { /* private fields */ }
Expand description

Base class of the collections of column and row definitions.

When parsed from a string, the items are separated by “,” or “ “.

Implementations§

Source§

impl<T: ObjectType + Upcast<DefinitionBase>> DefinitionList<T>

Source

pub fn new() -> Self

Creates an empty collection.

Methods from Deref<Target = FerroList<Ref<T>>>§

Source

pub fn ptr_eq(&self, other: &FerroList<T>) -> bool

Whether two handles refer to the same list.

Source

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.

Source

pub fn remove_collection_changed(&self, token: u64) -> bool

Unsubscribes a handler.

Source

pub fn has_collection_changed_subscribers(&self) -> bool

Whether anything is subscribed to changes, typed or untyped.

Source

pub fn count(&self) -> usize

The number of items in the list.

Source

pub fn is_empty(&self) -> bool

Source

pub fn capacity(&self) -> usize

The number of items the list can hold before its storage grows.

Source

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.

Source

pub fn reset_behavior(&self) -> ResetBehavior

The reset behavior of the list.

Source

pub fn set_reset_behavior(&self, value: ResetBehavior)

Source

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.

Source

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.

Source

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.

Source

pub fn set_validator(&self, value: Option<Rc<dyn IFerroListItemValidator<T>>>)

Source

pub fn get(&self, index: usize) -> T

The item at index. Panics if out of range.

Source

pub fn try_get(&self, index: usize) -> Option<T>

The item at index, if in range.

Source

pub fn set(&self, index: usize, value: T)
where T: PartialEq,

Replaces the item at index.

Source

pub fn snapshot(&self) -> Rc<Vec<T>>

A snapshot of the items. It stays valid and unchanged if the list is modified.

Source

pub fn to_vec(&self) -> Vec<T>

Copies the items into a vector.

Source

pub fn for_each(&self, f: impl FnMut(&T))

Calls f for each item of a snapshot of the list.

Source

pub fn add(&self, item: T)

Adds an item to the collection.

Source

pub fn add_range(&self, items: impl IntoIterator<Item = T>)

Adds multiple items to the collection.

Source

pub fn insert(&self, index: usize, item: T)

Inserts an item at the specified index.

Source

pub fn insert_range(&self, index: usize, items: impl IntoIterator<Item = T>)

Inserts multiple items at the specified index.

Source

pub fn move_item(&self, old_index: usize, new_index: usize)

Moves an item to a new index.

Source

pub fn move_range(&self, old_index: usize, count: usize, new_index: usize)

Moves multiple items to a new index.

Source

pub fn remove_at(&self, index: usize)

Removes the item at the specified index.

Source

pub fn remove_range(&self, index: usize, count: usize)

Removes a range of elements from the collection.

Source

pub fn clear(&self)

Removes all items from the collection.

Source

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.

Source

pub fn get_range(&self, index: usize, count: usize) -> Vec<T>

Gets a range of items from the collection.

Source

pub fn ensure_capacity(&self, capacity: usize)

Ensures that the capacity of the list is at least capacity.

Source

pub fn contains(&self, item: &T) -> bool

Tests whether the collection contains an item.

Source

pub fn index_of(&self, item: &T) -> Option<usize>

The index of an item in the collection.

Source

pub fn remove(&self, item: &T) -> bool

Removes an item from the collection. Returns true if it was present.

Source

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<T: ObjectType + Upcast<DefinitionBase>> Clone for DefinitionList<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ObjectType + Upcast<DefinitionBase>> Default for DefinitionList<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: ObjectType + Upcast<DefinitionBase>> Deref for DefinitionList<T>

Source§

type Target = FerroList<Ref<T>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: ObjectType + Upcast<DefinitionBase>> PartialEq for DefinitionList<T>

Handles compare by identity.

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for DefinitionList<T>

§

impl<T> !Send for DefinitionList<T>

§

impl<T> !Sync for DefinitionList<T>

§

impl<T> !UnwindSafe for DefinitionList<T>

§

impl<T> Freeze for DefinitionList<T>
where Rc<DefinitionListData<T>>: Freeze,

§

impl<T> Unpin for DefinitionList<T>
where Rc<DefinitionListData<T>>: Unpin,

§

impl<T> UnsafeUnpin for DefinitionList<T>
where Rc<DefinitionListData<T>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.