mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 21:41:37 +00:00
62 lines
1.5 KiB
Rust
62 lines
1.5 KiB
Rust
//! Implements the IMFS fetcher interface for a fake filesystem using Rust's
|
|
//! std::fs interface.
|
|
|
|
// This interface is only used for testing, so it's okay if it isn't used.
|
|
#![allow(unused)]
|
|
|
|
use std::{
|
|
io,
|
|
path::{Path, PathBuf},
|
|
};
|
|
|
|
use crossbeam_channel::Receiver;
|
|
|
|
use super::{
|
|
event::ImfsEvent,
|
|
fetcher::{FileType, ImfsFetcher},
|
|
};
|
|
|
|
pub struct NoopFetcher;
|
|
|
|
impl ImfsFetcher for NoopFetcher {
|
|
fn file_type(&mut self, _path: &Path) -> io::Result<FileType> {
|
|
Err(io::Error::new(
|
|
io::ErrorKind::NotFound,
|
|
"NoopFetcher always returns NotFound",
|
|
))
|
|
}
|
|
|
|
fn read_children(&mut self, _path: &Path) -> io::Result<Vec<PathBuf>> {
|
|
Err(io::Error::new(
|
|
io::ErrorKind::NotFound,
|
|
"NoopFetcher always returns NotFound",
|
|
))
|
|
}
|
|
|
|
fn read_contents(&mut self, _path: &Path) -> io::Result<Vec<u8>> {
|
|
Err(io::Error::new(
|
|
io::ErrorKind::NotFound,
|
|
"NoopFetcher always returns NotFound",
|
|
))
|
|
}
|
|
|
|
fn create_directory(&mut self, _path: &Path) -> io::Result<()> {
|
|
Ok(())
|
|
}
|
|
|
|
fn write_file(&mut self, _path: &Path, _contents: &[u8]) -> io::Result<()> {
|
|
Ok(())
|
|
}
|
|
|
|
fn remove(&mut self, _path: &Path) -> io::Result<()> {
|
|
Ok(())
|
|
}
|
|
|
|
fn watch(&mut self, _path: &Path) {}
|
|
|
|
fn unwatch(&mut self, _path: &Path) {}
|
|
|
|
fn receiver(&self) -> Receiver<ImfsEvent> {
|
|
crossbeam_channel::never()
|
|
}
|
|
}
|