stak_file/file_system/
void.rs1use crate::{FileDescriptor, FileError, FileSystem};
2use stak_vm::{Memory, Value};
3
4#[derive(Debug)]
6pub struct VoidFileSystem {}
7
8impl VoidFileSystem {
9 pub const fn new() -> Self {
11 Self {}
12 }
13}
14
15impl FileSystem for VoidFileSystem {
16 type Path = [u8];
17 type PathBuf = [u8; 0];
18 type Error = FileError;
19
20 fn open(&mut self, _: &Self::Path, _: bool) -> Result<FileDescriptor, Self::Error> {
21 Err(FileError::Open)
22 }
23
24 fn close(&mut self, _: FileDescriptor) -> Result<(), Self::Error> {
25 Err(FileError::Close)
26 }
27
28 fn read(&mut self, _: FileDescriptor) -> Result<u8, Self::Error> {
29 Err(FileError::Read)
30 }
31
32 fn write(&mut self, _: FileDescriptor, _: u8) -> Result<(), Self::Error> {
33 Err(FileError::Write)
34 }
35
36 fn delete(&mut self, _: &Self::Path) -> Result<(), Self::Error> {
37 Err(FileError::Delete)
38 }
39
40 fn exists(&self, _: &Self::Path) -> Result<bool, Self::Error> {
41 Err(FileError::Exists)
42 }
43
44 fn decode_path(_: &Memory, _: Value) -> Result<Self::PathBuf, Self::Error> {
45 Err(FileError::PathDecode)
46 }
47}
48
49impl Default for VoidFileSystem {
50 fn default() -> Self {
51 Self::new()
52 }
53}