pub trait Component: Sized + 'static {
const TEMPLATE_HASH: &'static str = "";
const TEMPLATE_HTML: &'static str = "";
// Required method
fn mount(self) -> Result<Scope, JsValue>;
// Provided methods
fn mount_with(
make: impl FnOnce(OwnerHandle) -> Self,
) -> Result<Scope, JsValue> { ... }
fn try_mount_with(
make: impl FnOnce(OwnerHandle) -> Result<Self, JsValue>,
) -> Result<Scope, JsValue> { ... }
fn prepare(
parent: &OwnerHandle,
make: impl FnOnce(OwnerHandle) -> Result<Self, JsValue>,
) -> Result<Scope, JsValue> { ... }
}Expand description
Implemented by the HTML build for each rust:component="RustType".
State is shared by the generated closures without requiring Clone.
Keep the returned scope alive; dropping it releases every binding.
Provided Associated Constants§
const TEMPLATE_HASH: &'static str = ""
const TEMPLATE_HTML: &'static str = ""
Required Methods§
Provided Methods§
Sourcefn mount_with(make: impl FnOnce(OwnerHandle) -> Self) -> Result<Scope, JsValue>
fn mount_with(make: impl FnOnce(OwnerHandle) -> Self) -> Result<Scope, JsValue>
Construct state after template validation, with its own weak lifetime.
fn try_mount_with( make: impl FnOnce(OwnerHandle) -> Result<Self, JsValue>, ) -> Result<Scope, JsValue>
Sourcefn prepare(
parent: &OwnerHandle,
make: impl FnOnce(OwnerHandle) -> Result<Self, JsValue>,
) -> Result<Scope, JsValue>
fn prepare( parent: &OwnerHandle, make: impl FnOnce(OwnerHandle) -> Result<Self, JsValue>, ) -> Result<Scope, JsValue>
Prepare a child while owner-activation registrations wait. Ordinary constructor effects keep their immediate timing. Attach, then commit the returned scope; dropping it rolls back preparation. Used by outlets.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".