ItemsSource
struct · ferroui-controls · v0.5.0
struct ItemsSource
A shared handle to an untyped items list: the value of an items source property.
Equality is the identity of the underlying collection.
Members
newfrom_itemsfrom_valuesfrom_strslistcountget_atindex_ofcontainsis_notifyingdowncast_refidentityptr_eqiterto_vecregister_binding_conversion_withregister_binding_conversion
new
fn new(list: Rc<dyn IItemsList>) -> Self
Wraps a list.
from_items
fn from_items(items: impl IntoIterator<Item = Option<BoxedValue>>) -> Self
Creates a non-notifying source holding the given items.
from_values
fn from_values<T: PropertyValue>(values: impl IntoIterator<Item = T>) -> Self
Creates a non-notifying source by boxing each of the given values.
from_strs
fn from_strs<'a>(values: impl IntoIterator<Item = &'a str>) -> Self
Creates a non-notifying source of strings.
list
fn list(self: &Self) -> &Rc<dyn IItemsList>
The list.
count
fn count(self: &Self) -> usize
The number of items.
get_at
fn get_at(self: &Self, index: usize) -> Option<BoxedValue>
The item at index. Panics if out of range.
index_of
fn index_of(self: &Self, item: &Option<BoxedValue>) -> i32
The index of the first item equal to item, or -1.
contains
fn contains(self: &Self, item: &Option<BoxedValue>) -> bool
Whether the list contains an item equal to item.
is_notifying
fn is_notifying(self: &Self) -> bool
Whether the list notifies of changes.
downcast_ref
fn downcast_ref<T: 'static>(self: &Self) -> Option<&T>
The typed collection behind the source, if it is a T.
identity
fn identity(self: &Self) -> usize
The identity of the underlying collection.
ptr_eq
fn ptr_eq(self: &Self, other: &ItemsSource) -> bool
Whether two handles refer to the same collection.
iter
fn iter(self: &Self) -> impl Iterator<Item = Option<BoxedValue>> + '_
The items, enumerated by index over the live list.
to_vec
fn to_vec(self: &Self) -> Vec<Option<BoxedValue>>
A copy of the items.
register_binding_conversion_with
fn register_binding_conversion_with<S: 'static>(convert: fn(&S) -> ItemsSource)
Lets bindings deliver a value of the collection type S to a
property of type Option<ItemsSource> (or ItemsSource) on the
current thread.
register_binding_conversion for a
collection type that converts with convert (a list handle that is delivered as
the shared list).
register_binding_conversion
fn register_binding_conversion<S: Clone + Into<ItemsSource> + 'static>()
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherMarkupTypedFrom<NavigationStack>From<&'a ItemsSource>ClonePartialEqDebugFrom<Rc<dyn IItemsList>>From<Rc<ItemsSourceView>>From<Rc<FerroList<T>>>From<Rc<BindableList<T>>>From<Vec<Option<Rc<dyn AnyValue>>>>From<Vec<Rc<dyn AnyValue>>>From<Rc<Vec<Option<Rc<dyn AnyValue>>>>>From<CommandBarElementCollection>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.