pub struct NodeHost { /* private fields */ }Expand description
Concrete Node-compatible capability state.
Environment and arguments are explicit rather than inherited from the embedding process, keeping executions independent of the invoking machine.
Implementations§
Source§impl NodeHost
impl NodeHost
pub fn new() -> Self
pub fn stdout(&self) -> &[u8] ⓘ
pub fn stderr(&self) -> &[u8] ⓘ
pub const fn exit_code(&self) -> i32
pub fn set_argv(&mut self, argv: impl IntoIterator<Item = String>)
pub fn argv(&self) -> &[String]
pub fn env(&self, name: &str) -> Option<&str>
pub fn set_env(&mut self, name: impl Into<String>, value: impl Into<String>)
pub fn delete_env(&mut self, name: &str) -> bool
pub fn set_script_compiler(&mut self, compiler: Box<dyn CompileProvider>)
Trait Implementations§
Source§impl Host for NodeHost
impl Host for NodeHost
fn write_stdout(&mut self, bytes: &[u8])
fn write_stderr(&mut self, bytes: &[u8])
fn exit_code(&self) -> i32
fn set_exit_code(&mut self, exit_code: i32)
fn argv(&self) -> &[String]
fn env(&self, name: &str) -> Option<&str>
fn set_env(&mut self, name: &str, value: &str)
fn delete_env(&mut self, name: &str) -> bool
fn now_ms(&mut self) -> u64
fn monotonic_ns(&mut self) -> u64
fn random(&mut self) -> f64
Source§fn script_compiler(&mut self) -> Option<&mut (dyn CompileProvider + 'static)>
fn script_compiler(&mut self) -> Option<&mut (dyn CompileProvider + 'static)>
This host’s script compiler, or
None when it provides none. Read moreSource§fn timers(&mut self) -> Option<&mut (dyn TimerProvider + 'static)>
fn timers(&mut self) -> Option<&mut (dyn TimerProvider + 'static)>
This host’s timer scheduler, or
None when it provides none. Read morefn hash(&mut self, algorithm: &str, data: &[u8]) -> Option<Vec<u8>>
Auto Trait Implementations§
impl !RefUnwindSafe for NodeHost
impl !Send for NodeHost
impl !Sync for NodeHost
impl !UnwindSafe for NodeHost
impl Freeze for NodeHost
impl Unpin for NodeHost
impl UnsafeUnpin for NodeHost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more