Skip to main content

Module

Trait Module 

Source
pub trait Module<R: Renderer> {
    // Required method
    fn mount(
        &self,
        target: &R::Node,
        props: &Map<String, Value>,
        bus: Member,
    ) -> Result<Box<dyn ModuleInstance>, String>;

    // Provided method
    fn css(&self) -> Option<String> { ... }
}
Expand description

A component’s code, ready to mount.

Required Methods§

Source

fn mount( &self, target: &R::Node, props: &Map<String, Value>, bus: Member, ) -> Result<Box<dyn ModuleInstance>, String>

Draws into target with props, speaking through bus; a module that throws is refused with its words (and leaves target empty).

Provided Methods§

Source

fn css(&self) -> Option<String>

FRAME-30: its sheet’s text — what the module exports as css (a svelte/1 module’s compiled <style>); none when it has none.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§