Skip to main content

ModelSlot

Struct ModelSlot 

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

One recycled row’s connection to its store: the slot a model list’s row builder receives. Copy, and a day-model Source, so #[derive(Observable)] accessors hang off it. text_field(slot.name()) binds two-way and follows the slot to its next row when the cell recycles, because the slot resolves its row on every operation.

Implementations§

Source§

impl<T> ModelSlot<T>
where T: Identified + Clone + 'static,

Source

pub fn for_key(store: Store<Keyed<T>>, key: u64) -> ModelSlot<T>

A slot pointed at key, for row sources implemented outside this crate (a live query). Application code receives slots from list/each instead.

Source

pub fn rebind_key(&self, key: u64)

The recycle write, for external row sources: point this slot at another key.

Source§

impl<T> ModelSlot<T>
where T: Identified + 'static,

Source

pub fn key(self) -> u64

The row’s key right now, tracked, so a closure reading it follows recycling (a context-menu action captures the slot and acts on whichever row the cell shows when it runs).

Source

pub fn item(self) -> Elem<T>

The current row as a plain element handle, for exists() guards or handing to code outside the row. Tracked via the slot, so it follows recycling too.

Trait Implementations§

Source§

impl<T> Clone for ModelSlot<T>

Source§

fn clone(&self) -> ModelSlot<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Copy for ModelSlot<T>

Source§

impl<T> Source<T> for ModelSlot<T>
where T: Identified + 'static,

Source§

const DYNAMIC: bool = true

Whether this source’s location can change over the handle’s lifetime: a recycled list slot whose current row rotates. Fields projected from a dynamic source resolve their path through the source on every operation instead of trusting the one cached at projection time, and their tracked reads also run Source::track_extra.
Source§

fn track_extra(self)

Extra tracking a projected field’s tracked reads perform. A dynamic source tracks its own rebind signal here, so a control bound at build follows the slot to its next row.
Source§

fn path(self) -> Path

The path this source occupies. Implementations revalidate against the interner, so the result is always current.
Source§

fn node(self) -> NodeId

This source’s interned id, so a child can be built with no lookup of its own. Read more
Source§

fn components(self, out: &mut Vec<u64>)

The path as plain components, resolved by walking the handle chain rather than the interner. This is what crosses a thread boundary: a worker names what it changed with components, and the main thread re-establishes them on its own side when it announces.
Source§

fn with_value_untracked<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R

Source§

fn update_value(self, f: impl FnOnce(&mut T)) -> bool

Returns false when the value is gone (a deleted row), in which case nothing is announced either.
Source§

fn bump_version(self)

Source§

fn with<R>(self, f: impl FnOnce(Option<&T>) -> R) -> R

Tracked read of the whole value: the coarse subscription.

Auto Trait Implementations§

§

impl<T> !Send for ModelSlot<T>

§

impl<T> !Sync for ModelSlot<T>

§

impl<T> Freeze for ModelSlot<T>

§

impl<T> RefUnwindSafe for ModelSlot<T>

§

impl<T> Unpin for ModelSlot<T>

§

impl<T> UnsafeUnpin for ModelSlot<T>

§

impl<T> UnwindSafe for ModelSlot<T>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoReactive<T, StaticMark> for T
where T: Clone + 'static,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

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.