Struct wasmer_wasi_asml_fork::WasiFs [−][src]
pub struct WasiFs {
pub preopen_fds: Vec<u32>,
pub name_map: HashMap<String, Inode>,
pub inodes: Arena<InodeVal>,
pub fd_map: HashMap<u32, Fd>,
pub next_fd: Cell<u32>,
pub orphan_fds: HashMap<Inode, InodeVal>,
// some fields omitted
}
Expand description
Warning, modifying these fields directly may cause invariants to break and should be considered unsafe. These fields may be made private in a future release
Fields
preopen_fds: Vec<u32>
name_map: HashMap<String, Inode>
inodes: Arena<InodeVal>
fd_map: HashMap<u32, Fd>
next_fd: Cell<u32>
orphan_fds: HashMap<Inode, InodeVal>
for fds still open after the file has been deleted
Implementations
Get the WasiFile
object at stdout
Get the WasiFile
object at stdout mutably
Get the WasiFile
object at stderr
Get the WasiFile
object at stderr mutably
Get the WasiFile
object at stdin
Get the WasiFile
object at stdin mutably
pub unsafe fn open_dir_all(
&mut self,
base: __wasi_fd_t,
name: String,
rights: __wasi_rights_t,
rights_inheriting: __wasi_rights_t,
flags: __wasi_fdflags_t
) -> Result<__wasi_fd_t, WasiFsError>
pub unsafe fn open_dir_all(
&mut self,
base: __wasi_fd_t,
name: String,
rights: __wasi_rights_t,
rights_inheriting: __wasi_rights_t,
flags: __wasi_fdflags_t
) -> Result<__wasi_fd_t, WasiFsError>
This function is like create dir all, but it also opens it. Function is unsafe because it may break invariants and hasn’t been tested. This is an experimental function and may be removed
Safety
- Virtual directories created with this function must not conflict with the standard operation of the WASI filesystem. This is vague and unlikely in pratice. Join the discussion for what the newer, safer WASI FS APIs should look like.
pub fn open_file_at(
&mut self,
base: __wasi_fd_t,
file: Box<dyn WasiFile>,
open_flags: u16,
name: String,
rights: __wasi_rights_t,
rights_inheriting: __wasi_rights_t,
flags: __wasi_fdflags_t
) -> Result<__wasi_fd_t, WasiFsError>
pub fn open_file_at(
&mut self,
base: __wasi_fd_t,
file: Box<dyn WasiFile>,
open_flags: u16,
name: String,
rights: __wasi_rights_t,
rights_inheriting: __wasi_rights_t,
flags: __wasi_fdflags_t
) -> Result<__wasi_fd_t, WasiFsError>
Opens a user-supplied file in the directory specified with the name and flags given
pub fn swap_file(
&mut self,
fd: __wasi_fd_t,
file: Box<dyn WasiFile>
) -> Result<Option<Box<dyn WasiFile>>, WasiFsError>
pub fn swap_file(
&mut self,
fd: __wasi_fd_t,
file: Box<dyn WasiFile>
) -> Result<Option<Box<dyn WasiFile>>, WasiFsError>
Change the backing of a given file descriptor Returns the old backing TODO: add examples
gets either a normal inode or an orphaned inode
pub fn create_fd(
&mut self,
rights: __wasi_rights_t,
rights_inheriting: __wasi_rights_t,
flags: __wasi_fdflags_t,
open_flags: u16,
inode: Inode
) -> Result<__wasi_fd_t, __wasi_errno_t>
Low level function to remove an inode, that is it deletes the WASI FS’s knowledge of a file.
This function returns the inode if it existed and was removed.
Safety
- The caller must ensure that all references to the specified inode have been removed from the filesystem.
Trait Implementations
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl !RefUnwindSafe for WasiFs
impl !UnwindSafe for WasiFs
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more