[−][src]Struct wasmer_wasi::WasiFs
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
impl WasiFs
[src]
pub fn new(
preopened_dirs: &[PathBuf],
mapped_dirs: &[(String, PathBuf)]
) -> Result<Self, String>
[src]
preopened_dirs: &[PathBuf],
mapped_dirs: &[(String, PathBuf)]
) -> Result<Self, String>
This method will change or be made private in the future. Please use WasiState::new
and the builder API instead.
Internal function for constructing a WasiFs
. Please use
WasiState::new
.
pub fn stdout(&self) -> Result<&Option<Box<dyn WasiFile>>, WasiFsError>
[src]
Get the WasiFile
object at stdout
pub fn stdout_mut(
&mut self
) -> Result<&mut Option<Box<dyn WasiFile>>, WasiFsError>
[src]
&mut self
) -> Result<&mut Option<Box<dyn WasiFile>>, WasiFsError>
Get the WasiFile
object at stdout mutably
pub fn stderr(&self) -> Result<&Option<Box<dyn WasiFile>>, WasiFsError>
[src]
Get the WasiFile
object at stderr
pub fn stderr_mut(
&mut self
) -> Result<&mut Option<Box<dyn WasiFile>>, WasiFsError>
[src]
&mut self
) -> Result<&mut Option<Box<dyn WasiFile>>, WasiFsError>
Get the WasiFile
object at stderr mutably
pub fn stdin(&self) -> Result<&Option<Box<dyn WasiFile>>, WasiFsError>
[src]
Get the WasiFile
object at stdin
pub fn stdin_mut(
&mut self
) -> Result<&mut Option<Box<dyn WasiFile>>, WasiFsError>
[src]
&mut self
) -> Result<&mut Option<Box<dyn WasiFile>>, WasiFsError>
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>
[src]
&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>
[src]
&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>
[src]
&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
pub fn get_fd(&self, fd: __wasi_fd_t) -> Result<&Fd, __wasi_errno_t>
[src]
pub fn get_inodeval_mut(
&mut self,
fd: __wasi_fd_t
) -> Result<&mut InodeVal, __wasi_errno_t>
[src]
&mut self,
fd: __wasi_fd_t
) -> Result<&mut InodeVal, __wasi_errno_t>
gets either a normal inode or an orphaned inode
pub fn filestat_fd(
&self,
fd: __wasi_fd_t
) -> Result<__wasi_filestat_t, __wasi_errno_t>
[src]
&self,
fd: __wasi_fd_t
) -> Result<__wasi_filestat_t, __wasi_errno_t>
pub fn fdstat(&self, fd: __wasi_fd_t) -> Result<__wasi_fdstat_t, __wasi_errno_t>
[src]
pub fn prestat_fd(
&self,
fd: __wasi_fd_t
) -> Result<__wasi_prestat_t, __wasi_errno_t>
[src]
&self,
fd: __wasi_fd_t
) -> Result<__wasi_prestat_t, __wasi_errno_t>
pub fn flush(&mut self, fd: __wasi_fd_t) -> Result<(), __wasi_errno_t>
[src]
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>
[src]
&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>
pub unsafe fn remove_inode(&mut self, inode: Inode) -> Option<InodeVal>
[src]
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.
pub fn get_stat_for_kind(&self, kind: &Kind) -> Option<__wasi_filestat_t>
[src]
Trait Implementations
impl Debug for WasiFs
[src]
impl<'de> Deserialize<'de> for WasiFs
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for WasiFs
[src]
Auto Trait Implementations
impl !RefUnwindSafe for WasiFs
[src]
impl Send for WasiFs
[src]
impl !Sync for WasiFs
[src]
impl Unpin for WasiFs
[src]
impl !UnwindSafe for WasiFs
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
T: Serialize + ?Sized,
pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
[src]
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,