pub(crate) struct WasiState {
pub secret: [u8; 32],
pub fs: WasiFs,
pub inodes: WasiInodes,
pub futexs: Mutex<WasiFutexState>,
pub clock_offset: Mutex<HashMap<Snapshot0Clockid, i64>>,
pub args: Mutex<Vec<String>>,
pub envs: Mutex<Vec<Vec<u8>>>,
pub signals: Mutex<HashMap<Signal, Disposition>>,
pub signal_handler_registered: AtomicBool,
pub preopen: Vec<String>,
}Expand description
Top level data type containing all* the state with which WASI can interact.
- The contents of files are not stored and may be modified by other, concurrently running programs. Data such as the contents of directories are lazily loaded.
Fields§
§secret: [u8; 32]§fs: WasiFs§inodes: WasiInodes§futexs: Mutex<WasiFutexState>§clock_offset: Mutex<HashMap<Snapshot0Clockid, i64>>§args: Mutex<Vec<String>>§envs: Mutex<Vec<Vec<u8>>>§signals: Mutex<HashMap<Signal, Disposition>>§signal_handler_registered: AtomicBoolWhether this process has registered a signal handler callback.
WasiModuleInstanceHandles::signal_set only records whether the
instance doing the asking registered one, and every spawned thread gets
its own instance. Signals are delivered to all of a process’s threads,
so a per-instance flag makes sibling threads believe the program handles
no signals and apply the runtime’s default disposition – terminating a
process that does in fact have a handler installed.
preopen: Vec<String>Implementations§
Source§impl WasiState
impl WasiState
pub(crate) fn fs_read_dir<P: AsRef<Path>>( &self, path: P, ) -> Result<ReadDir, Errno>
pub(crate) fn fs_create_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Errno>
pub(crate) fn fs_remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Errno>
pub(crate) async fn fs_rename<P: AsRef<Path>, Q: AsRef<Path>>( &self, from: P, to: Q, ) -> Result<(), Errno>
pub(crate) fn fs_remove_file<P: AsRef<Path>>( &self, path: P, ) -> Result<(), Errno>
pub(crate) fn fs_new_open_options(&self) -> OpenOptions<'_>
Sourcepub fn stdout(
&self,
) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
pub fn stdout( &self, ) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
Get the VirtualFile object at stdout
Sourcepub fn stderr(
&self,
) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
pub fn stderr( &self, ) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
Get the VirtualFile object at stderr
Sourcepub fn stdin(
&self,
) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
pub fn stdin( &self, ) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
Get the VirtualFile object at stdin
Sourcefn std_dev_get(
&self,
fd: WasiFd,
) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
fn std_dev_get( &self, fd: WasiFd, ) -> Result<Option<Box<dyn VirtualFile + Send + Sync + 'static>>, FsError>
Internal helper function to get a standard device handle.
Expects one of __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO, __WASI_STDERR_FILENO.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WasiState
impl !RefUnwindSafe for WasiState
impl Send for WasiState
impl Sync for WasiState
impl Unpin for WasiState
impl UnsafeUnpin for WasiState
impl !UnwindSafe for WasiState
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more