mod error;
#[cfg(feature = "libc")]
mod libc;
mod memory;
#[cfg(feature = "std")]
mod os;
mod utility;
mod void;
pub use self::error::FileError;
use core::error::Error;
#[cfg(feature = "libc")]
pub use libc::LibcFileSystem;
pub use memory::MemoryFileSystem;
#[cfg(feature = "std")]
pub use os::OsFileSystem;
use stak_vm::{Memory, Value};
pub use void::VoidFileSystem;
pub type FileDescriptor = usize;
pub trait FileSystem {
type Path: ?Sized;
type PathBuf: AsRef<Self::Path>;
type Error: Error;
fn open(&mut self, path: &Self::Path, output: bool) -> Result<FileDescriptor, Self::Error>;
fn close(&mut self, descriptor: FileDescriptor) -> Result<(), Self::Error>;
fn read(&mut self, descriptor: FileDescriptor) -> Result<u8, Self::Error>;
fn write(&mut self, descriptor: FileDescriptor, byte: u8) -> Result<(), Self::Error>;
fn delete(&mut self, path: &Self::Path) -> Result<(), Self::Error>;
fn exists(&self, path: &Self::Path) -> Result<bool, Self::Error>;
fn decode_path(memory: &Memory, list: Value) -> Result<Self::PathBuf, Self::Error>;
}