Skip to main content

ItemsSource

Struct ItemsSource 

Source
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

Source

pub fn new(list: Rc<dyn IItemsList>) -> Self

Wraps a list.

Source

pub fn from_items(items: impl IntoIterator<Item = Option<BoxedValue>>) -> Self

Creates a non-notifying source holding the given items.

Source

pub fn from_values<T: PropertyValue>( values: impl IntoIterator<Item = T>, ) -> Self

Creates a non-notifying source by boxing each of the given values.

Source

pub fn from_strs<'a>(values: impl IntoIterator<Item = &'a str>) -> Self

Creates a non-notifying source of strings.

Source

pub fn list(&self) -> &Rc<dyn IItemsList>

The list.

Source

pub fn count(&self) -> usize

The number of items.

Source

pub fn get_at(&self, index: usize) -> Option<BoxedValue>

The item at index. Panics if out of range.

Source

pub fn index_of(&self, item: &Option<BoxedValue>) -> i32

The index of the first item equal to item, or -1.

Source

pub fn contains(&self, item: &Option<BoxedValue>) -> bool

Whether the list contains an item equal to item.

Source

pub fn is_notifying(&self) -> bool

Whether the list notifies of changes.

Source

pub fn downcast_ref<T: 'static>(&self) -> Option<&T>

The typed collection behind the source, if it is a T.

Source

pub fn identity(&self) -> usize

The identity of the underlying collection.

Source

pub fn ptr_eq(&self, other: &ItemsSource) -> bool

Whether two handles refer to the same collection.

Source

pub fn iter(&self) -> impl Iterator<Item = Option<BoxedValue>> + '_

The items, enumerated by index over the live list.

Source

pub fn to_vec(&self) -> Vec<Option<BoxedValue>>

A copy of the items.

Source

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).

Source

pub fn register_binding_conversion<S: Clone + Into<ItemsSource> + 'static>()

Trait Implementations§

Source§

impl Clone for ItemsSource

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 Debug for ItemsSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a ItemsSource> for ItemsView<'a>

Source§

fn from(source: &'a ItemsSource) -> Self

Converts to this type from the input type.
Source§

impl From<CommandBarElementCollection> for ItemsSource

Source§

fn from(value: CommandBarElementCollection) -> Self

Converts to this type from the input type.
Source§

impl<T: PropertyValue> From<Rc<BindableList<T>>> for ItemsSource

Source§

fn from(value: Rc<BindableList<T>>) -> Self

Converts to this type from the input type.
Source§

impl<T: PropertyValue> From<Rc<FerroList<T>>> for ItemsSource

Source§

fn from(value: Rc<FerroList<T>>) -> Self

Converts to this type from the input type.
Source§

impl From<Rc<Vec<Option<Rc<dyn AnyValue>>>>> for ItemsSource

Source§

fn from(value: Rc<Vec<Option<BoxedValue>>>) -> Self

Converts to this type from the input type.
Source§

impl From<Rc<dyn IItemsList>> for ItemsSource

Source§

fn from(value: Rc<dyn IItemsList>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Option<Rc<dyn AnyValue>>>> for ItemsSource

Source§

fn from(value: Vec<Option<BoxedValue>>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Rc<dyn AnyValue>>> for ItemsSource

Source§

fn from(value: Vec<BoxedValue>) -> Self

Converts to this type from the input type.
Source§

impl MarkupTyped for ItemsSource

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.
Source§

impl PartialEq for ItemsSource

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§

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<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.