Skip to main content

ScriptPlugin

Struct ScriptPlugin 

Source
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>

Source

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).

Source

pub fn with_uri(self, uri: impl Into<String>) -> Self

Override the source URI reported in compile errors.

Source

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.

Trait Implementations§

Source§

impl<H: ScriptHost + Resource<Mutability = Mutable>> Plugin for ScriptPlugin<H>

Source§

fn build(self, app: &mut App)

Registers systems and resources on app, consuming the plugin.
Source§

fn name(&self) -> &'static str

Returns the plugin’s name for diagnostics; defaults to the type name.
Source§

fn depends_on(&self) -> &'static [&'static str]

Returns the list of plugin names this plugin depends on. Default: empty. Read more
Source§

fn cleanup(&mut self, _app: &mut App)

Optional teardown hook. Default no-op. Read more

Auto Trait Implementations§

§

impl<H> Freeze for ScriptPlugin<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for ScriptPlugin<H>
where H: RefUnwindSafe,

§

impl<H> Send for ScriptPlugin<H>

§

impl<H> Sync for ScriptPlugin<H>

§

impl<H> Unpin for ScriptPlugin<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for ScriptPlugin<H>
where H: UnsafeUnpin,

§

impl<H> UnwindSafe for ScriptPlugin<H>
where H: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ConditionalSend for T
where T: Send,