Expand description
§remotefs-memory
A memory-based implementation of the remotefs
crate.
This crate provides a simple in-memory filesystem that can be used for testing purposes.
§Getting Started
Add remotefs-memory
to your Cargo.toml
:
remotefs = "0.3"
remotefs-memory = "0.1"
§Example
use std::path::PathBuf;
use remotefs_memory::{Inode, MemoryFs, node, Node, Tree};
use remotefs::RemoteFs;
use remotefs::fs::{UnixPex, Metadata};
let tempdir = PathBuf::from("/tmp");
let tree = Tree::new(node!(
PathBuf::from("/"),
Inode::dir(0, 0, UnixPex::from(0o755)),
node!(tempdir.clone(), Inode::dir(0, 0, UnixPex::from(0o755)))
));
let mut client = MemoryFs::new(tree);
assert!(client.connect().is_ok());
// Change directory
assert!(client.change_dir(tempdir.as_path()).is_ok());
Macros§
Structs§
- Inode
- Inode is the data stored in each node of the filesystem.
- Memory
Fs - MemoryFs is a simple in-memory filesystem that can be used for testing purposes.
- Node
- Describes a node inside the
Tree
U: is the type for the node indentifier (must implement PartialEq) T: is the type for the node value - Tree
- represent the tree data structure inside the component.
U: is the type for the
Node
indentifier (must implementPartialEq
) T: is the type for theNode
value