forked from rojo-rbx/rojo
Move ImfsEvent into its own module
This commit is contained in:
2
src/imfs/event.rs
Normal file
2
src/imfs/event.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
// TODO: Use our own event type instead of notify's.
|
||||
pub type ImfsEvent = notify::DebouncedEvent;
|
||||
@@ -5,15 +5,14 @@ use std::{
|
||||
|
||||
use crossbeam_channel::Receiver;
|
||||
|
||||
use super::event::ImfsEvent;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum FileType {
|
||||
File,
|
||||
Directory,
|
||||
}
|
||||
|
||||
// TODO: Use our own event type instead of notify's.
|
||||
pub type ImfsEvent = notify::DebouncedEvent;
|
||||
|
||||
/// The generic interface that `Imfs` uses to lazily read files from the disk.
|
||||
/// In tests, it's stubbed out to do different versions of absolutely nothing
|
||||
/// depending on the test.
|
||||
|
||||
@@ -9,7 +9,8 @@ use crate::path_map::PathMap;
|
||||
|
||||
use super::{
|
||||
error::{FsError, FsResult},
|
||||
fetcher::{FileType, ImfsEvent, ImfsFetcher},
|
||||
event::ImfsEvent,
|
||||
fetcher::{FileType, ImfsFetcher},
|
||||
snapshot::ImfsSnapshot,
|
||||
};
|
||||
|
||||
@@ -425,7 +426,7 @@ mod test {
|
||||
use crossbeam_channel::Receiver;
|
||||
use maplit::hashmap;
|
||||
|
||||
use super::super::{error::FsErrorKind, fetcher::ImfsEvent, noop_fetcher::NoopFetcher};
|
||||
use super::super::{error::FsErrorKind, event::ImfsEvent, noop_fetcher::NoopFetcher};
|
||||
|
||||
#[test]
|
||||
fn from_snapshot_file() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
mod error;
|
||||
mod event;
|
||||
mod fetcher;
|
||||
mod imfs;
|
||||
mod noop_fetcher;
|
||||
@@ -6,6 +7,7 @@ mod real_fetcher;
|
||||
mod snapshot;
|
||||
|
||||
pub use error::*;
|
||||
pub use event::*;
|
||||
pub use fetcher::*;
|
||||
pub use imfs::*;
|
||||
pub use noop_fetcher::*;
|
||||
|
||||
@@ -11,7 +11,10 @@ use std::{
|
||||
|
||||
use crossbeam_channel::Receiver;
|
||||
|
||||
use super::fetcher::{FileType, ImfsEvent, ImfsFetcher};
|
||||
use super::{
|
||||
event::ImfsEvent,
|
||||
fetcher::{FileType, ImfsFetcher},
|
||||
};
|
||||
|
||||
pub struct NoopFetcher;
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ use crossbeam_channel::{unbounded, Receiver};
|
||||
use jod_thread::JoinHandle;
|
||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||
|
||||
use super::fetcher::{FileType, ImfsEvent, ImfsFetcher};
|
||||
use super::{
|
||||
event::ImfsEvent,
|
||||
fetcher::{FileType, ImfsFetcher},
|
||||
};
|
||||
|
||||
/// Workaround to disable the file watcher for processes that don't need it,
|
||||
/// since notify appears hang on to mpsc Sender objects too long, causing Rojo
|
||||
|
||||
Reference in New Issue
Block a user