pub struct JsRuntimeConfig {
pub platform: JsRuntimePlatform,
pub module_resolution: JsModuleResolution,
pub allowed_builtins: Option<Vec<String>>,
pub snapshot_userland_code: Option<String>,
}Expand description
Guest JavaScript host-environment configuration.
Selects which globals/builtins/module-resolution surface guest JS sees,
modeled on esbuild’s platform. Omitting this preserves full Node.js
emulation (platform = node).
Fields§
§platform: JsRuntimePlatformWhich host environment to emulate for guest JS. Default node.
module_resolution: JsModuleResolutionHow bare import specifiers resolve. Independent of platform.
Default node.
allowed_builtins: Option<Vec<String>>Node builtin-module allow-list. Only valid when platform = node.
None => engine default allow-list. Some([]) => deny all builtins.
Some([..]) => exactly those.
snapshot_userland_code: Option<String>Optional userland JS (an esbuild IIFE, e.g. a bundled agent SDK) to
evaluate into the per-sidecar V8 startup snapshot alongside the bridge, so
it is loaded once per sidecar and reused across sessions instead of
re-imported on every execution. The snapshot is cached process-wide keyed
by sha256(bridge + this code). Trusted client config; None keeps the
bridge-only snapshot. Must be snapshot-safe (no native/External handles,
fds, timers, or non-deterministic reads at module-init).
Trait Implementations§
Source§impl Clone for JsRuntimeConfig
impl Clone for JsRuntimeConfig
Source§fn clone(&self) -> JsRuntimeConfig
fn clone(&self) -> JsRuntimeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JsRuntimeConfig
impl Debug for JsRuntimeConfig
Source§impl Default for JsRuntimeConfig
impl Default for JsRuntimeConfig
Source§fn default() -> JsRuntimeConfig
fn default() -> JsRuntimeConfig
Source§impl<'de> Deserialize<'de> for JsRuntimeConfig
impl<'de> Deserialize<'de> for JsRuntimeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for JsRuntimeConfig
Source§impl PartialEq for JsRuntimeConfig
impl PartialEq for JsRuntimeConfig
Source§fn eq(&self, other: &JsRuntimeConfig) -> bool
fn eq(&self, other: &JsRuntimeConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for JsRuntimeConfig
impl Serialize for JsRuntimeConfig
impl StructuralPartialEq for JsRuntimeConfig
Source§impl TS for JsRuntimeConfig
impl TS for JsRuntimeConfig
Source§const DOCS: Option<&'static str>
const DOCS: Option<&'static str>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§type WithoutGenerics = JsRuntimeConfig
type WithoutGenerics = JsRuntimeConfig
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or ().
The only requirement for these dummy types is that EXPORT_TO must be None. Read moreSource§fn decl_concrete() -> String
fn decl_concrete() -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl() -> String
fn decl() -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline() -> String
fn inline() -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened() -> String
fn inline_flattened() -> String
This function will panic if the type cannot be flattened.
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<&'static Path>
fn output_path() -> Option<&'static Path>
T should be exported.The returned path does not include the base directory from
TS_RS_EXPORT_DIR. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies() -> Vec<Dependency>where
Self: 'static,
fn dependencies() -> Vec<Dependency>where
Self: 'static,
Source§fn export() -> Result<(), ExportError>where
Self: 'static,
fn export() -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all() -> Result<(), ExportError>where
Self: 'static,
fn export_all() -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use
TS::export. Read moreSource§fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use
TS::export. Read more