Struct panoramix::elements::ElementList[][src]

pub struct ElementList<Child: Element<CpEvent, CpState>, CpEvent = NoEvent, CpState = ()> {
    pub children: Vec<(String, Child)>,
    pub _comp_state: PhantomData<CpState>,
    pub _comp_event: PhantomData<CpEvent>,
}

A list of elements of the same type.

Events

Doesn’t emit events.

About keys

ElementList stores a Vec of (String, Child), where the string must be a unique key.

Keys help Panoramix figure out element identity, and maintain widget persistence. For instance, if your element list before update looks like:

[
    ("foo-1", MyComponent("foo")),
    ("foo-2", MyComponent("foo")),
    ("bar-3", MyComponent("bar")),
];

and your element list post-update looks like:

[
    ("foo-1", MyComponent("foo")),
    ("bar-3", MyComponent("bar")),
];

Panoramix will figure out that the element at foo-2 has been removed, and will remove it from the underlying widget tree, as well as perform any necessary cleanup.

Fields

children: Vec<(String, Child)>_comp_state: PhantomData<CpState>_comp_event: PhantomData<CpEvent>

Implementations

impl<CpEvent, CpState, Child: Element<CpEvent, CpState>> ElementList<Child, CpEvent, CpState>[src]

pub fn from_pairs(pairs: impl IntoIterator<Item = (String, Child)>) -> Self[src]

Build a list by providing an iterator of (Key, Element) pairs.

pub fn from_keys_elems(
    keys: impl IntoIterator<Item = String>,
    elems: impl IntoIterator<Item = Child>
) -> Self
[src]

Build a list by providing keys and elements as separate iterators.

Trait Implementations

impl<Child: Element<CpEvent, CpState>, CpEvent, CpState> Clone for ElementList<Child, CpEvent, CpState> where
    Child: Clone
[src]

impl<Child: Element<CpEvent, CpState>, CpEvent, CpState> Debug for ElementList<Child, CpEvent, CpState>[src]

impl<Child: Element<CpEvent, CpState>, CpEvent, CpState> Default for ElementList<Child, CpEvent, CpState>[src]

impl<CpEvent, CpState, Child: Element<CpEvent, CpState>> Element<CpEvent, CpState> for ElementList<Child, CpEvent, CpState>[src]

type Event = NoEvent

The type of events this element can raise. Read more

type AggregateChildrenState = Vec<(String, Child::AggregateChildrenState)>

type BuildOutput = ElementListData<Child::BuildOutput, CpEvent, CpState>

impl<Child: Eq + Element<CpEvent, CpState>, CpEvent: Eq, CpState: Eq> Eq for ElementList<Child, CpEvent, CpState>[src]

impl<Child: Hash + Element<CpEvent, CpState>, CpEvent: Hash, CpState: Hash> Hash for ElementList<Child, CpEvent, CpState>[src]

impl<Child: PartialEq + Element<CpEvent, CpState>, CpEvent: PartialEq, CpState: PartialEq> PartialEq<ElementList<Child, CpEvent, CpState>> for ElementList<Child, CpEvent, CpState>[src]

impl<Child: Element<CpEvent, CpState>, CpEvent, CpState> StructuralEq for ElementList<Child, CpEvent, CpState>[src]

impl<Child: Element<CpEvent, CpState>, CpEvent, CpState> StructuralPartialEq for ElementList<Child, CpEvent, CpState>[src]

Auto Trait Implementations

impl<Child, CpEvent, CpState> RefUnwindSafe for ElementList<Child, CpEvent, CpState> where
    Child: RefUnwindSafe,
    CpEvent: RefUnwindSafe,
    CpState: RefUnwindSafe

impl<Child, CpEvent, CpState> Send for ElementList<Child, CpEvent, CpState> where
    Child: Send,
    CpEvent: Send,
    CpState: Send

impl<Child, CpEvent, CpState> Sync for ElementList<Child, CpEvent, CpState> where
    Child: Sync,
    CpEvent: Sync,
    CpState: Sync

impl<Child, CpEvent, CpState> Unpin for ElementList<Child, CpEvent, CpState> where
    Child: Unpin,
    CpEvent: Unpin,
    CpState: Unpin

impl<Child, CpEvent, CpState> UnwindSafe for ElementList<Child, CpEvent, CpState> where
    Child: UnwindSafe,
    CpEvent: UnwindSafe,
    CpState: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyEq for T where
    T: Any + PartialEq<T>, 

impl<T> AnyState for T where
    T: Clone + Default + Debug + PartialEq<T> + 'static, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.