Skip to main content

BindableArray

Struct BindableArray 

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

Source

pub fn new(items: impl IntoIterator<Item = T>) -> Rc<Self>

Creates a one-dimensional array.

Source

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.

Source

pub fn lengths(&self) -> &[usize]

The length of each dimension.

Source

pub fn len(&self) -> usize

The total number of elements.

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, indexes: &[usize]) -> T

The element at indexes. Panics if out of range.

Source

pub fn set(&self, indexes: &[usize], value: T)

Replaces the element at indexes. Panics if out of range.

Source

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

The elements in row-major order.

Trait Implementations§

Source§

impl<T: PropertyValue> IBindableArray for BindableArray<T>

Source§

fn rank(&self) -> usize

The number of dimensions.
Source§

fn element_type(&self) -> ValueType

The type of the elements.
Source§

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>

Replaces the element at indexes.
Source§

impl<T: PropertyValue> IBindableIndexer for BindableArray<T>

Source§

fn index_parameter_types(&self) -> Vec<ValueType>

The types of the index parameters, in order.
Source§

fn value_type(&self) -> ValueType

The type of the values of the indexer.
Source§

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>

Writes the value at arguments. Returns Ok(false) if the indexer has no setter.
Source§

fn can_set(&self) -> bool

Whether the indexer has a setter.
Source§

impl<T: PropertyValue> PartialEq for BindableArray<T>

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> !Freeze for BindableArray<T>

§

impl<T> !RefUnwindSafe for BindableArray<T>

§

impl<T> !Sync for BindableArray<T>

§

impl<T> Send for BindableArray<T>
where RefCell<Vec<T>>: Send,

§

impl<T> Unpin for BindableArray<T>
where RefCell<Vec<T>>: Unpin,

§

impl<T> UnsafeUnpin for BindableArray<T>
where RefCell<Vec<T>>: UnsafeUnpin,

§

impl<T> UnwindSafe for BindableArray<T>
where RefCell<Vec<T>>: UnwindSafe,

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