1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Asynchronous port of virtual file system abstraction
//!
//!
//! Just as with the synchronous version, the main interaction with the virtual filesystem is by using virtual paths ([`AsyncVfsPath`](path/struct.AsyncVfsPath.html)).
//!
//! This module currently has the following asynchronous file system implementations:
//!
//! * **[`AsyncPhysicalFS`](impls/physical/struct.AsyncPhysicalFS.html)** - the actual filesystem of the underlying OS
//! * **[`AsyncMemoryFS`](impls/memory/struct.AsyncMemoryFS.html)** - an ephemeral in-memory implementation (intended for unit tests)
//! * **[`AsyncAltrootFS`](impls/altroot/struct.AsyncAltrootFS.html)** - a file system with its root in a particular directory of another filesystem
//! * **[`AsyncOverlayFS`](impls/overlay/struct.AsyncOverlayFS.html)** - a union file system consisting of a read/writable upper layer and several read-only lower layers
//!
//! # Usage Examples
//!
//! ```
//! use async_std::io::{ReadExt, WriteExt};
//! use vfs::async_vfs::{AsyncVfsPath, AsyncPhysicalFS};
//! use vfs::VfsError;
//!
//! # tokio_test::block_on(async {
//! let root: AsyncVfsPath = AsyncPhysicalFS::new(std::env::current_dir().unwrap()).into();
//! assert!(root.exists().await?);
//!
//! let mut content = String::new();
//! root.join("README.md")?.open_file().await?.read_to_string(&mut content).await?;
//! assert!(content.contains("vfs"));
//! # Ok::<(), VfsError>(())
//! # });
//! ```
//!
//! ```
//! use async_std::io::{ReadExt, WriteExt};
//! use vfs::async_vfs::{AsyncVfsPath, AsyncMemoryFS};
//! use vfs::VfsError;
//!
//! # tokio_test::block_on(async {
//! let root: AsyncVfsPath = AsyncMemoryFS::new().into();
//! let path = root.join("test.txt")?;
//! assert!(!path.exists().await?);
//!
//! path.create_file().await?.write_all(b"Hello world").await?;
//! assert!(path.exists().await?);
//! let mut content = String::new();
//! path.open_file().await?.read_to_string(&mut content).await?;
//! assert_eq!(content, "Hello world");
//! # Ok::<(), VfsError>(())
//! # });
//! ```
//!
pub use AsyncFileSystem;
pub use AsyncAltrootFS;
pub use AsyncMemoryFS;
pub use AsyncOverlayFS;
pub use AsyncPhysicalFS;
pub use *;