Skip to main content

For

Struct For 

Source
pub struct For<T: 'static, K: 'static> { /* private fields */ }
Expand description

Keyed list rendering. Vue’s v-for with :key.

Items are matched by key between updates: existing rows keep their nodes and state (and are moved if needed), new keys render new rows, and rows whose key disappeared are disposed. A row is rendered once per key; put signals inside items for per-row updates. Keys should be unique: a key that comes again renders its later rows anew on every update.

Implementations§

Source§

impl<T: Clone + 'static, K: Eq + Hash + 'static> For<T, K>

Source

pub fn new<V: View>( each: impl IntoValue<Vec<T>>, key: impl Fn(&T) -> K + 'static, render: impl Fn(T) -> V + 'static, ) -> For<T, K>

Trait Implementations§

Source§

impl<T: Clone + 'static, K: Eq + Hash + 'static> View for For<T, K>

Source§

fn build(self, ui: &Ui) -> NodeId

Auto Trait Implementations§

§

impl<T, K> !RefUnwindSafe for For<T, K>

§

impl<T, K> !Send for For<T, K>

§

impl<T, K> !Sync for For<T, K>

§

impl<T, K> !UnwindSafe for For<T, K>

§

impl<T, K> Forget for For<T, K>

§

impl<T, K> Freeze for For<T, K>
where *const u8 is !null: Freeze, PhantomData<T>: Freeze, *const RcInner<dyn Fn() -> Vec<T>> is !null: Freeze, PhantomData<RcInner<dyn Fn() -> Vec<T>>>: Freeze, *const RcInner<dyn Fn(&T) -> K> is !null: Freeze, PhantomData<RcInner<dyn Fn(&T) -> K>>: Freeze, *const RcInner<dyn Fn(T) -> AnyView> is !null: Freeze, PhantomData<RcInner<dyn Fn(T) -> AnyView>>: Freeze,

§

impl<T, K> Move for For<T, K>

§

impl<T, K> Unpin for For<T, K>
where T: Unpin, *const u8 is !null: Unpin, Rc<dyn Fn() -> Vec<T>>: Unpin, Rc<dyn Fn(&T) -> K>: Unpin, Rc<dyn Fn(T) -> AnyView>: Unpin,

§

impl<T, K> UnsafeUnpin for For<T, K>
where *const u8 is !null: UnsafeUnpin, PhantomData<T>: UnsafeUnpin, *const RcInner<dyn Fn() -> Vec<T>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn() -> Vec<T>>>: UnsafeUnpin, *const RcInner<dyn Fn(&T) -> K> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&T) -> K>>: UnsafeUnpin, *const RcInner<dyn Fn(T) -> AnyView> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(T) -> AnyView>>: UnsafeUnpin,

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> 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<V> Children for V
where V: View,

Source§

fn into_views(self, out: &mut Vec<AnyView>)

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.