fuser_async/
lib.rs

1#![doc = include_str!("../README.md")]
2#![doc(html_root_url = "https://docs.rs/fuser-async/0.1.1")]
3// Implementations
4// pub mod implementations;
5// pub use implementations::local;
6// #[cfg(feature = "s3")]
7// pub use implementations::s3;
8// Internals
9mod async_readseek;
10mod error;
11mod filesystem;
12mod fuse;
13// Interface
14pub use async_readseek::FileHandle;
15pub use error::Error;
16pub use filesystem::Filesystem;
17pub use fuse::FilesystemFUSE;
18// Utils
19pub mod cache;
20pub mod remapping;
21pub mod rwlockoption;
22pub mod utils;
23
24use std::path::Path;
25
26trait_set::trait_set! {
27    /// Trait alias for a  [`Filesystem`] that is [`Send`], [`Sync`], [`std::marker::Unpin`] and `'static`.
28    pub trait FilesystemSSUS = Filesystem + Send + Sync  + std::marker::Unpin + 'static;
29}
30
31/// Directory entry (returned by [`Filesystem::readdir`]).
32#[derive(Debug)]
33pub struct DirEntry {
34    pub inode: u64,
35    pub file_type: fuser::FileType,
36    pub name: String, // TODO: Use OsStr and/or Cow
37}
38impl DirEntry {
39    pub fn path(&self) -> &Path {
40        Path::new(&self.name)
41    }
42}
43
44/// Trait for filesystems that can be refreshed.
45#[async_trait::async_trait]
46pub trait Refresh {
47    type Error;
48    /// Refresh filesystem
49    async fn refresh(&mut self) -> Result<(), Self::Error>;
50    /// Cleanup caches
51    async fn cleanup(&self) -> Result<(), Self::Error>;
52}