pub struct Prop<T: 'static> { /* private fields */ }Expand description
A prop of a component that runs once (a field of its #[derive(Props)]
struct): read it in a binding, props.max.get(), and the binding runs
again when it changes. Copy, like a signal: closures capture it as it
is.
A Rust parent passes a value, a signal, a memo or a closure (.into(),
Prop::bind); JS passes values, one prop at a time. In the
component’s instance each prop is a signal of its own, so a new value
from JS (or a parent’s binding) reaches only what read it.
Implementations§
Source§impl<T: Clone + PartialEq + 'static> Prop<T>
impl<T: Clone + PartialEq + 'static> Prop<T>
Sourcepub fn bind(f: impl Fn() -> T + 'static) -> Self
pub fn bind(f: impl Fn() -> T + 'static) -> Self
A prop bound to f (a memo of the current owner): run again when
what it reads changes.
Sourcepub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
f of the value, subscribing the running computation.
Sourcepub fn get_untracked(&self) -> T
pub fn get_untracked(&self) -> T
The value, without subscribing.
Sourcepub fn with_untracked<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn with_untracked<R>(&self, f: impl FnOnce(&T) -> R) -> R
f of the value, without subscribing.
Source§impl Prop<Option<Slot>>
impl Prop<Option<Slot>>
Sourcepub fn place(
self,
style: impl Fn(SlotElement) -> SlotElement + 'static,
) -> AnyElement
pub fn place( self, style: impl Fn(SlotElement) -> SlotElement + 'static, ) -> AnyElement
The slot where the app fills it, styled by style: it comes and
goes as the app fills and empties it.
Trait Implementations§
impl<T> Copy for Prop<T>
Source§impl From<Prop<Children>> for Children
The app’s children, to wrap one by one (.children_each(props.children, ..)).
impl From<Prop<Children>> for Children
The app’s children, to wrap one by one (.children_each(props.children, ..)).
Source§impl<T: Clone + PartialEq + 'static> From<ReadSignal<T>> for Prop<T>
impl<T: Clone + PartialEq + 'static> From<ReadSignal<T>> for Prop<T>
Source§fn from(value: ReadSignal<T>) -> Self
fn from(value: ReadSignal<T>) -> Self
Source§fn from(value: SharedString) -> Self
fn from(value: SharedString) -> Self
Source§impl From<bool> for Prop<Option<bool>>
An optional flag given as a flag (.cover(false)): set, where left out
is a default of the component’s own.
impl From<bool> for Prop<Option<bool>>
An optional flag given as a flag (.cover(false)): set, where left out
is a default of the component’s own.
Source§impl IntoElement for Prop<Children>
The app’s children placed here, all at one place (.child(props.children)).
impl IntoElement for Prop<Children>
The app’s children placed here, all at one place (.child(props.children)).
Source§fn into_element(self) -> AnyElement
fn into_element(self) -> AnyElement
Auto Trait Implementations§
impl<T> Forget for Prop<T>
impl<T> Freeze for Prop<T>
impl<T> Move for Prop<T>
impl<T> RefUnwindSafe for Prop<T>
impl<T> Send for Prop<T>
impl<T> Sync for Prop<T>
impl<T> Unpin for Prop<T>
impl<T> UnsafeUnpin for Prop<T>
impl<T> UnwindSafe for Prop<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoElements for Twhere
T: IntoElement,
impl<T> IntoElements for Twhere
T: IntoElement,
Source§fn into_elements(self) -> Vec<AnyElement>
fn into_elements(self) -> Vec<AnyElement>
Source§impl<T> IntoUniform for Twhere
T: IntoReactive<UniformValue>,
impl<T> IntoUniform for Twhere
T: IntoReactive<UniformValue>,
Source§fn into_uniform(self) -> Uniform
fn into_uniform(self) -> Uniform
Uniform.