mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Move ImfsEvent into its own module
This commit is contained in:
parent
bcf4fea598
commit
1737da9c1f
6 changed files with 17 additions and 7 deletions
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 crossbeam_channel::Receiver;
|
||||||
|
|
||||||
|
use super::event::ImfsEvent;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum FileType {
|
pub enum FileType {
|
||||||
File,
|
File,
|
||||||
Directory,
|
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.
|
/// 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
|
/// In tests, it's stubbed out to do different versions of absolutely nothing
|
||||||
/// depending on the test.
|
/// depending on the test.
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ use crate::path_map::PathMap;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
error::{FsError, FsResult},
|
error::{FsError, FsResult},
|
||||||
fetcher::{FileType, ImfsEvent, ImfsFetcher},
|
event::ImfsEvent,
|
||||||
|
fetcher::{FileType, ImfsFetcher},
|
||||||
snapshot::ImfsSnapshot,
|
snapshot::ImfsSnapshot,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -425,7 +426,7 @@ mod test {
|
||||||
use crossbeam_channel::Receiver;
|
use crossbeam_channel::Receiver;
|
||||||
use maplit::hashmap;
|
use maplit::hashmap;
|
||||||
|
|
||||||
use super::super::{error::FsErrorKind, fetcher::ImfsEvent, noop_fetcher::NoopFetcher};
|
use super::super::{error::FsErrorKind, event::ImfsEvent, noop_fetcher::NoopFetcher};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn from_snapshot_file() {
|
fn from_snapshot_file() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
mod error;
|
mod error;
|
||||||
|
mod event;
|
||||||
mod fetcher;
|
mod fetcher;
|
||||||
mod imfs;
|
mod imfs;
|
||||||
mod noop_fetcher;
|
mod noop_fetcher;
|
||||||
|
|
@ -6,6 +7,7 @@ mod real_fetcher;
|
||||||
mod snapshot;
|
mod snapshot;
|
||||||
|
|
||||||
pub use error::*;
|
pub use error::*;
|
||||||
|
pub use event::*;
|
||||||
pub use fetcher::*;
|
pub use fetcher::*;
|
||||||
pub use imfs::*;
|
pub use imfs::*;
|
||||||
pub use noop_fetcher::*;
|
pub use noop_fetcher::*;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ use std::{
|
||||||
|
|
||||||
use crossbeam_channel::Receiver;
|
use crossbeam_channel::Receiver;
|
||||||
|
|
||||||
use super::fetcher::{FileType, ImfsEvent, ImfsFetcher};
|
use super::{
|
||||||
|
event::ImfsEvent,
|
||||||
|
fetcher::{FileType, ImfsFetcher},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct NoopFetcher;
|
pub struct NoopFetcher;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ use crossbeam_channel::{unbounded, Receiver};
|
||||||
use jod_thread::JoinHandle;
|
use jod_thread::JoinHandle;
|
||||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
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,
|
/// 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
|
/// since notify appears hang on to mpsc Sender objects too long, causing Rojo
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue