V8

Trait V8 

pub trait V8:
    Send
    + Sync
    + 'static {
    // Required methods
    fn new(context: V8Context) -> Result<Self, ApplicationError>
       where Self: Sized;
    fn entry(&self) -> &str;

    // Provided method
    fn resolve(&self, _url: &str) -> Result<Option<ModuleSource>, Error> { ... }
}
Expand description

Stateful Browser-side resource provider for the native V8 utility backend.

The browser obtains module sources only when a named session is requested. This trait creates one reusable Rust provider per name and Browser runtime; native creates an independent JS isolate for each session. Provider methods may run concurrently.

Required Methods§

fn new(context: V8Context) -> Result<Self, ApplicationError>
where Self: Sized,

Creates Browser-side provider state on first use. A failure is retained for this runtime.

fn entry(&self) -> &str

Returns a relative entry path or an absolute HTTPS/file module URL.

Provided Methods§

fn resolve(&self, _url: &str) -> Result<Option<ModuleSource>, Error>

Resolves a canonical app-scheme://service.utility/path.mjs, HTTPS or file URL in the browser’s worker runtime.

Application resources use the app scheme and name.utility host. HTTPS/file URLs still pass through this provider; it owns I/O and access policy. Return Some(source) to override app.assets, None to fall back, or Err to fail loading without fallback. The default uses app.assets exclusively. Called on demand for an entry or static import. Each URL is requested once per session; the utility caches compiled modules and never reads files.

Implementors§