pub struct Expr<T> { /* private fields */ }Expand description
A value with a JavaScript expression that can produce it in the browser.
Expressions that read no signals render as static content. Their JavaScript remains available when needed for browser execution.
Implementations§
Source§impl<T> Expr<T>
impl<T> Expr<T>
Sourcepub fn evaluate(evaluate: impl FnOnce() -> T, js: Js) -> Self
pub fn evaluate(evaluate: impl FnOnce() -> T, js: Js) -> Self
Evaluates an expression while observing signal reads.
The evaluation is synchronous. Its signal reads must represent the dependencies of the JavaScript expression as well.
Sourcepub fn is_static(&self) -> bool
pub fn is_static(&self) -> bool
Whether this expression is known not to require reactive evaluation.
Signal reads during evaluate make it dynamic.
Sourcepub fn into_evaluated_and_js(self) -> (T, Js)
pub fn into_evaluated_and_js(self) -> (T, Js)
Returns the value and its JavaScript, including for static expressions.
Trait Implementations§
Source§impl<T> NodeViewParts for Expr<T>where
T: NodeViewParts,
impl<T> NodeViewParts for Expr<T>where
T: NodeViewParts,
Source§fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
Appends this value to the view being built.
Auto Trait Implementations§
impl<T> Freeze for Expr<T>where
T: Freeze,
impl<T> RefUnwindSafe for Expr<T>where
T: RefUnwindSafe,
impl<T> Send for Expr<T>where
T: Send,
impl<T> Sync for Expr<T>where
T: Sync,
impl<T> Unpin for Expr<T>where
T: Unpin,
impl<T> UnsafeUnpin for Expr<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Expr<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more