Struct wasmer_wasix::state::WasiState
source · 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 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>>>
§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 !UnwindSafe for WasiState
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
§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> ⓘ
Converts
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> ⓘ
Converts
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<T> Upcastable for T
impl<T> Upcastable for T
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
§impl<T> Upcastable for T
impl<T> Upcastable for T
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref
§fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
upcast boxed dyn