pub struct BindableArray<T: PropertyValue> { /* private fields */ }Expand description
An array that bindings can index into: one or more dimensions of fixed lengths, stored in row-major order.
As a model object it has identity equality.
Implementations§
Source§impl<T: PropertyValue> BindableArray<T>
impl<T: PropertyValue> BindableArray<T>
Sourcepub fn new(items: impl IntoIterator<Item = T>) -> Rc<Self>
pub fn new(items: impl IntoIterator<Item = T>) -> Rc<Self>
Creates a one-dimensional array.
Sourcepub fn with_lengths(
lengths: &[usize],
items: impl IntoIterator<Item = T>,
) -> Rc<Self>
pub fn with_lengths( lengths: &[usize], items: impl IntoIterator<Item = T>, ) -> Rc<Self>
Creates an array with the given length of each dimension, from its elements in row-major order. Panics if the number of elements is not the product of the lengths.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<T: PropertyValue> IBindableArray for BindableArray<T>
impl<T: PropertyValue> IBindableArray for BindableArray<T>
Source§fn element_type(&self) -> ValueType
fn element_type(&self) -> ValueType
The type of the elements.
Source§fn get_value(&self, indexes: &[i32]) -> Result<Option<BoxedValue>, BindingError>
fn get_value(&self, indexes: &[i32]) -> Result<Option<BoxedValue>, BindingError>
The element at
indexes.Source§fn set_value(
&self,
indexes: &[i32],
value: Option<&BoxedValue>,
) -> Result<(), BindingError>
fn set_value( &self, indexes: &[i32], value: Option<&BoxedValue>, ) -> Result<(), BindingError>
Replaces the element at
indexes.Source§impl<T: PropertyValue> IBindableIndexer for BindableArray<T>
impl<T: PropertyValue> IBindableIndexer for BindableArray<T>
Source§fn index_parameter_types(&self) -> Vec<ValueType>
fn index_parameter_types(&self) -> Vec<ValueType>
The types of the index parameters, in order.
Source§fn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
The type of the values of the indexer.
Source§fn get(
&self,
arguments: &[BoxedValue],
) -> Result<Option<BoxedValue>, BindingError>
fn get( &self, arguments: &[BoxedValue], ) -> Result<Option<BoxedValue>, BindingError>
Reads the value at
arguments, which hold exactly the declared
parameter types. An error is what the getter of a managed indexer
throws: a missing key, an index out of range.Source§fn set(
&self,
arguments: &[BoxedValue],
value: Option<&BoxedValue>,
) -> Result<bool, BindingError>
fn set( &self, arguments: &[BoxedValue], value: Option<&BoxedValue>, ) -> Result<bool, BindingError>
Writes the value at
arguments. Returns Ok(false) if the indexer
has no setter.Auto Trait Implementations§
impl<T> !Freeze for BindableArray<T>
impl<T> !RefUnwindSafe for BindableArray<T>
impl<T> !Sync for BindableArray<T>
impl<T> Send for BindableArray<T>
impl<T> Unpin for BindableArray<T>
impl<T> UnsafeUnpin for BindableArray<T>
impl<T> UnwindSafe for BindableArray<T>
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
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
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