pub struct ScriptPlugin<H: ScriptHost + Resource<Mutability = Mutable>> { /* private fields */ }Expand description
Generic script plugin: loads source into the supplied host, fires
on_start (re-stashing its commands into the sink so they flow
through the first tick’s normal drain), installs the host as a
Resource, and registers the full dispatcher / derivation / timer /
fetch system set.
Host construction (engine limits, builtin registration, embedder extensions) happens BEFORE this plugin: build the host, apply any host-specific extensions, then hand it over. A host module’s own plugin is a thin wrapper doing exactly that.
Implementations§
Source§impl<H: ScriptHost + Resource<Mutability = Mutable>> ScriptPlugin<H>
impl<H: ScriptHost + Resource<Mutability = Mutable>> ScriptPlugin<H>
Sourcepub fn new(host: H, source: impl Into<String>) -> Self
pub fn new(host: H, source: impl Into<String>) -> Self
Wrap a built host + script source. The source URI defaults to
"<inline>" (matches the historical compile-error shape).
Sourcepub fn with_uri(self, uri: impl Into<String>) -> Self
pub fn with_uri(self, uri: impl Into<String>) -> Self
Override the source URI reported in compile errors.
Sourcepub fn with_source_map(self, map: SourceMap) -> Self
pub fn with_source_map(self, map: SourceMap) -> Self
Say where each piece of the source was read from, so a compile error names the script file and line instead of the URI.