message: Added wasm32 part for vfs file access
diff: @@ -9,6 +9,8 @@ use std::fs;
  use std::io::{self, Read, Seek, Write};
  #[cfg(unix)]
  use std::os::unix::io::{AsRawFd, RawFd};
  +#[cfg(target_arch = "wasm32")]
  +use std::os::wasi::io::{AsRawFd, RawFd};
  #[cfg(windows)]
  use std::os::windows::io::{AsRawHandle, RawHandle};
  use std::path::{Path, PathBuf};
  @@ -67,6 +69,31 @@ impl TryInto<RawHandle> for FileDescriptor {
  }
  }
  +#[cfg(target_arch = "wasm32")]
  +impl<T> TryIntoFileDescriptor for T
  +where
  + T: AsRawFd,
  +{
  + type Error = FsError;
  +
  + fn try_into_filedescriptor(&self) -> std::result::Result<FileDescriptor, Self::Error> {
  + Ok(FileDescriptor(
  + self.as_raw_fd()
  + .try_into()
  + .map_err(|_| FsError::InvalidFd)?,
  + ))
  + }
  +}
  +
  +#[cfg(target_arch = "wasm32")]
  +impl TryInto<RawFd> for FileDescriptor {
  + type Error = FsError;
  +
  + fn try_into(self) -> std::result::Result<RawFd, Self::Error> {
  + self.0.try_into().map_err(|_| FsError::InvalidFd)
  + }
  +}
  +
  #[derive(Debug, Default, Clone)]
  #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
  pub struct FileSystem;
  