pub struct ItemsSource(/* private fields */);Expand description
A shared handle to an untyped items list: the value of an items source property.
Equality is the identity of the underlying collection.
Implementations§
Source§impl ItemsSource
impl ItemsSource
Sourcepub fn new(list: Rc<dyn IItemsList>) -> Self
pub fn new(list: Rc<dyn IItemsList>) -> Self
Wraps a list.
Sourcepub fn from_items(items: impl IntoIterator<Item = Option<BoxedValue>>) -> Self
pub fn from_items(items: impl IntoIterator<Item = Option<BoxedValue>>) -> Self
Creates a non-notifying source holding the given items.
Sourcepub fn from_values<T: PropertyValue>(
values: impl IntoIterator<Item = T>,
) -> Self
pub fn from_values<T: PropertyValue>( values: impl IntoIterator<Item = T>, ) -> Self
Creates a non-notifying source by boxing each of the given values.
Sourcepub fn from_strs<'a>(values: impl IntoIterator<Item = &'a str>) -> Self
pub fn from_strs<'a>(values: impl IntoIterator<Item = &'a str>) -> Self
Creates a non-notifying source of strings.
Sourcepub fn list(&self) -> &Rc<dyn IItemsList>
pub fn list(&self) -> &Rc<dyn IItemsList>
The list.
Sourcepub fn get_at(&self, index: usize) -> Option<BoxedValue>
pub fn get_at(&self, index: usize) -> Option<BoxedValue>
The item at index. Panics if out of range.
Sourcepub fn index_of(&self, item: &Option<BoxedValue>) -> i32
pub fn index_of(&self, item: &Option<BoxedValue>) -> i32
The index of the first item equal to item, or -1.
Sourcepub fn contains(&self, item: &Option<BoxedValue>) -> bool
pub fn contains(&self, item: &Option<BoxedValue>) -> bool
Whether the list contains an item equal to item.
Sourcepub fn is_notifying(&self) -> bool
pub fn is_notifying(&self) -> bool
Whether the list notifies of changes.
Sourcepub fn downcast_ref<T: 'static>(&self) -> Option<&T>
pub fn downcast_ref<T: 'static>(&self) -> Option<&T>
The typed collection behind the source, if it is a T.
Sourcepub fn ptr_eq(&self, other: &ItemsSource) -> bool
pub fn ptr_eq(&self, other: &ItemsSource) -> bool
Whether two handles refer to the same collection.
Sourcepub fn iter(&self) -> impl Iterator<Item = Option<BoxedValue>> + '_
pub fn iter(&self) -> impl Iterator<Item = Option<BoxedValue>> + '_
The items, enumerated by index over the live list.
Sourcepub fn to_vec(&self) -> Vec<Option<BoxedValue>>
pub fn to_vec(&self) -> Vec<Option<BoxedValue>>
A copy of the items.
Sourcepub fn register_binding_conversion_with<S: 'static>(
convert: fn(&S) -> ItemsSource,
)
pub 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).
pub fn register_binding_conversion<S: Clone + Into<ItemsSource> + 'static>()
Trait Implementations§
Source§impl Clone for ItemsSource
impl Clone for ItemsSource
Source§impl Debug for ItemsSource
impl Debug for ItemsSource
Source§impl<'a> From<&'a ItemsSource> for ItemsView<'a>
impl<'a> From<&'a ItemsSource> for ItemsView<'a>
Source§fn from(source: &'a ItemsSource) -> Self
fn from(source: &'a ItemsSource) -> Self
Source§impl From<CommandBarElementCollection> for ItemsSource
impl From<CommandBarElementCollection> for ItemsSource
Source§fn from(value: CommandBarElementCollection) -> Self
fn from(value: CommandBarElementCollection) -> Self
Source§impl<T: PropertyValue> From<Rc<BindableList<T>>> for ItemsSource
impl<T: PropertyValue> From<Rc<BindableList<T>>> for ItemsSource
Source§fn from(value: Rc<BindableList<T>>) -> Self
fn from(value: Rc<BindableList<T>>) -> Self
Source§impl<T: PropertyValue> From<Rc<FerroList<T>>> for ItemsSource
impl<T: PropertyValue> From<Rc<FerroList<T>>> for ItemsSource
Source§impl From<Rc<dyn IItemsList>> for ItemsSource
impl From<Rc<dyn IItemsList>> for ItemsSource
Source§fn from(value: Rc<dyn IItemsList>) -> Self
fn from(value: Rc<dyn IItemsList>) -> Self
Source§impl From<Vec<Rc<dyn AnyValue>>> for ItemsSource
impl From<Vec<Rc<dyn AnyValue>>> for ItemsSource
Source§fn from(value: Vec<BoxedValue>) -> Self
fn from(value: Vec<BoxedValue>) -> Self
Source§impl MarkupTyped for ItemsSource
impl MarkupTyped for ItemsSource
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !RefUnwindSafe for ItemsSource
impl !Send for ItemsSource
impl !Sync for ItemsSource
impl !UnwindSafe for ItemsSource
impl Freeze for ItemsSource
impl Unpin for ItemsSource
impl UnsafeUnpin for ItemsSource
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