pub struct FactoryVec<Data>where
    Data: FactoryPrototype,{ /* private fields */ }
Expand description

A container similar to Vec that implements Factory.

Implementations§

source§

impl<Data> FactoryVec<Data>where Data: FactoryPrototype,

source

pub fn new() -> Self

Create a new FactoryVec.

source

pub fn from_vec(data: Vec<Data>) -> Self

Initialize a new FactoryVec with a normal Vec.

source

pub fn as_slice(&self) -> &[Data]

Get a slice of the internal data of a FactoryVec.

source

pub fn into_vec(self) -> Vec<Data>

Get the internal data of the FactoryVec.

source

pub fn clear(&mut self)

Remove all data from the FactoryVec.

source

pub fn len(&self) -> usize

Returns the length as amount of elements stored in this type.

source

pub fn is_empty(&self) -> bool

Returns true if the length of this type is 0.

source

pub fn push(&mut self, data: Data)

Insert an element at the end of a FactoryVec.

source

pub fn pop(&mut self) -> Option<Data>

Remove an element at the end of a FactoryVec.

source

pub fn get(&self, index: usize) -> Option<&Data>

Get a reference to data stored at index.

source

pub fn get_mut(&mut self, index: usize) -> Option<&mut Data>

Get a mutable reference to data stored at index.

Assumes that the data will be modified and the corresponding widget needs to be updated.

source§

impl<Data, View> FactoryVec<Data>where Data: FactoryPrototype<Factory = Self, View = View>, View: FactoryView<Data::Root>,

source

pub fn iter(&self) -> Iter<'_, Data>

Get an immutable iterator for this type

Trait Implementations§

source§

impl<Data> Debug for FactoryVec<Data>where Data: FactoryPrototype + Debug, Data::Widgets: Debug, Data::View: Debug, Data::Root: Debug,

source§

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

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

impl<Data> Default for FactoryVec<Data>where Data: FactoryPrototype + Default, Data::Widgets: Default, Data::View: Default, Data::Root: Default,

source§

fn default() -> FactoryVec<Data>

Returns the “default value” for a type. Read more
source§

impl<Data, View> Factory<Data, View> for FactoryVec<Data>where Data: FactoryPrototype<Factory = Self, View = View>, View: FactoryView<Data::Root>,

§

type Key = usize

Key that provides additional information for the FactoryPrototype functions.
source§

fn generate(&self, view: &View, sender: Sender<Data::Msg>)

Efficiently update the view according to data changes.

Auto Trait Implementations§

§

impl<Data> !RefUnwindSafe for FactoryVec<Data>

§

impl<Data> Send for FactoryVec<Data>where Data: Send, <<Data as FactoryPrototype>::View as FactoryView<<Data as FactoryPrototype>::Root>>::Root: Send, <Data as FactoryPrototype>::Widgets: Send,

§

impl<Data> !Sync for FactoryVec<Data>

§

impl<Data> Unpin for FactoryVec<Data>where Data: Unpin, <<Data as FactoryPrototype>::View as FactoryView<<Data as FactoryPrototype>::Root>>::Root: Unpin, <Data as FactoryPrototype>::Widgets: Unpin,

§

impl<Data> UnwindSafe for FactoryVec<Data>where Data: UnwindSafe, <<Data as FactoryPrototype>::View as FactoryView<<Data as FactoryPrototype>::Root>>::Root: UnwindSafe, <Data as FactoryPrototype>::Widgets: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.