diff --git a/.cirrus.yml b/.cirrus.yml index dda92c8..b026970 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,7 +7,8 @@ build: &BUILD - rustup component add clippy - cargo check --all-targets --features=tokio-runtime,file-lock,unprivileged - cargo check --all-targets --features=async-std-runtime,file-lock,unprivileged - - cargo doc --no-deps --features=doc + # - RUSTDOCFLAGS="--cfg docsrs" cargo doc --features=file-lock,unprivileged,tokio-runtime # disable until doc_cfg and doc_auto_cfg are stable + - cargo doc --features=file-lock,unprivileged,tokio-runtime - cargo clippy --all-targets --features=tokio-runtime,file-lock,unprivileged - cargo clippy --all-targets --features=async-std-runtime,file-lock,unprivileged before_cache_script: rm -rf $HOME/.cargo/registry/index diff --git a/Cargo.toml b/Cargo.toml index 6208e7b..5c8fc2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ categories = ["api-bindings", "filesystem"] license = "MIT" repository = "https://github.com/Sherlock-Holo/fuse3" description = "FUSE user-space library async version implementation." -rust-version = "1.63" +rust-version = "1.75" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -21,22 +21,21 @@ tokio-runtime = ["tokio"] async-std-runtime = ["async-std", "async-io"] file-lock = [] unprivileged = ["nix/socket", "which"] -doc = ["file-lock", "unprivileged", "tokio-runtime"] [dependencies] -futures-util = { version = "0.3", features = ["sink"] } -futures-channel = { version = "0.3", features = ["sink"] } -async-trait = "0.1.2" -cstr = "0.2" -libc = "0.2.147" -bincode = "1.3.1" -serde = { version = "1.0.103", features = ["derive"] } -nix = { version = "0.27", default-features = false, features = ["fs", "mount"] } -which = { version = "4", optional = true } async-io = { version = "1.4", optional = true } +bincode = "1.3.3" bytes = "1" -slab = "0.4.2" -tracing = "0.1.21" +cstr = "0.2" +futures-channel = { version = "0.3", features = ["sink"] } +futures-util = { version = "0.3", features = ["sink"] } +libc = "0.2.153" +nix = { version = "0.27", default-features = false, features = ["fs", "mount"] } +serde = { version = "1.0.196", features = ["derive"] } +slab = "0.4.9" +tracing = "0.1.40" +trait-make = "0.1" +which = { version = "6", optional = true } [target.'cfg(target_os = "linux")'.dependencies] nix = { version = "0.27", default-features = false, features = ["user"] } @@ -52,7 +51,8 @@ features = ["fs", "rt", "sync", "net", "macros"] optional = true [package.metadata.docs.rs] -features = [ "doc" ] +rustdoc-args = ["--cfg", "docsrs"] +features = ["file-lock", "unprivileged", "tokio-runtime"] targets = [ "i686-unknown-freebsd", "i686-unknown-linux-gnu", diff --git a/examples/Cargo.toml b/examples/Cargo.toml index ebbcbb1..ea29472 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -25,12 +25,11 @@ path = "src/path_memfs/main.rs" [dependencies] fuse3 = { path = "../", features = ["tokio-runtime", "unprivileged"] } -async-trait = "0.1.2" -libc = "0.2.147" +libc = "0.2.153" tokio = { version = "1", features = ["macros", "rt", "time"] } futures-util = "0.3" mio = { version = "0.8", features = ["os-poll"] } tempfile = "3" bytes = "1" -tracing = "0.1.21" +tracing = "0.1.40" tracing-subscriber = "0.3" diff --git a/examples/src/helloworld/main.rs b/examples/src/helloworld/main.rs index b18fab6..2eab2d8 100644 --- a/examples/src/helloworld/main.rs +++ b/examples/src/helloworld/main.rs @@ -4,7 +4,6 @@ use std::iter::Skip; use std::time::{Duration, SystemTime}; use std::vec::IntoIter; -use async_trait::async_trait; use bytes::Bytes; use fuse3::raw::prelude::*; use fuse3::{MountOptions, Result}; @@ -33,7 +32,6 @@ const STATFS: ReplyStatFs = ReplyStatFs { struct HelloWorld; -#[async_trait] impl Filesystem for HelloWorld { type DirEntryStream = Iter>>>; type DirEntryPlusStream = Iter>>>; diff --git a/examples/src/memfs/main.rs b/examples/src/memfs/main.rs index 5057ae8..6db9e06 100644 --- a/examples/src/memfs/main.rs +++ b/examples/src/memfs/main.rs @@ -7,7 +7,6 @@ use std::sync::Arc; use std::time::{Duration, SystemTime}; use std::vec::IntoIter; -use async_trait::async_trait; use bytes::{Buf, BytesMut}; use fuse3::raw::prelude::*; use fuse3::{Errno, Inode, MountOptions, Result}; @@ -188,7 +187,6 @@ impl Default for Fs { } } -#[async_trait] impl Filesystem for Fs { type DirEntryStream = Empty>; type DirEntryPlusStream = Iter>>; diff --git a/examples/src/path_memfs/main.rs b/examples/src/path_memfs/main.rs index d5c7953..e05d414 100644 --- a/examples/src/path_memfs/main.rs +++ b/examples/src/path_memfs/main.rs @@ -5,7 +5,6 @@ use std::io::{Cursor, Read, Write}; use std::time::{Duration, SystemTime}; use std::vec::IntoIter; -use async_trait::async_trait; use bytes::{Buf, BufMut, BytesMut}; use fuse3::path::prelude::*; use fuse3::{Errno, MountOptions, Result}; @@ -138,7 +137,6 @@ impl Default for Fs { } } -#[async_trait] impl PathFilesystem for Fs { type DirEntryStream = Empty>; type DirEntryPlusStream = Iter>>; diff --git a/examples/src/poll/main.rs b/examples/src/poll/main.rs index 82171a1..31317c2 100644 --- a/examples/src/poll/main.rs +++ b/examples/src/poll/main.rs @@ -7,7 +7,6 @@ use std::sync::Arc; use std::time::{Duration, SystemTime}; use std::vec::IntoIter; -use async_trait::async_trait; use bytes::Bytes; use fuse3::raw::prelude::*; use fuse3::{MountOptions, Result}; @@ -32,7 +31,6 @@ struct Poll { ready: Arc, } -#[async_trait] impl Filesystem for Poll { type DirEntryStream = Iter>>>; type DirEntryPlusStream = Iter>>>; diff --git a/src/helper.rs b/src/helper.rs index 3b3f827..b604ff5 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -41,7 +41,7 @@ pub fn mode_from_kind_and_perm(kind: FileType, perm: u16) -> u32 { } /// returns the permission for a given file kind and mode -#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms. +#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms. pub fn perm_from_mode_and_kind(kind: FileType, mode: mode_t) -> u16 { (mode ^ mode_t::from(kind)) as u16 } diff --git a/src/lib.rs b/src/lib.rs index 61e54ff..73591f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,13 +17,13 @@ //! //! You must enable `async-std-runtime` or `tokio-runtime` feature. +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + use std::{ convert::TryInto, time::{Duration, SystemTime, UNIX_EPOCH}, }; -/// re-export [`async_trait`][async_trait::async_trait]. -pub use async_trait::async_trait; pub use errno::Errno; pub use helper::{mode_from_kind_and_perm, perm_from_mode_and_kind}; pub use mount_options::MountOptions; diff --git a/src/mount_options.rs b/src/mount_options.rs index c9adc02..0d45955 100644 --- a/src/mount_options.rs +++ b/src/mount_options.rs @@ -272,7 +272,7 @@ impl MountOptions { opts.push("allow_other".to_string()); } - if matches!(self.read_only, true) { + if self.read_only { opts.push("ro".to_string()); } diff --git a/src/path/inode_path_bridge.rs b/src/path/inode_path_bridge.rs index 8c403c2..99b8e52 100644 --- a/src/path/inode_path_bridge.rs +++ b/src/path/inode_path_bridge.rs @@ -7,7 +7,6 @@ use std::vec::IntoIter; #[cfg(all(not(feature = "tokio-runtime"), feature = "async-std-runtime"))] use async_std::sync::RwLock; -use async_trait::async_trait; use bytes::Bytes; use futures_util::stream::{self, Iter, Stream, StreamExt}; use slab::Slab; @@ -144,7 +143,6 @@ impl Debug for InodePathBridge { } } -#[async_trait] impl Filesystem for InodePathBridge where FS: PathFilesystem + Send + Sync, diff --git a/src/path/path_filesystem.rs b/src/path/path_filesystem.rs index 768703b..ef31336 100644 --- a/src/path/path_filesystem.rs +++ b/src/path/path_filesystem.rs @@ -1,6 +1,5 @@ use std::ffi::OsStr; -use async_trait::async_trait; use bytes::Bytes; use futures_util::stream::Stream; @@ -16,7 +15,7 @@ use crate::notify::Notify; use crate::{Result, SetAttr}; #[allow(unused_variables)] -#[async_trait] +#[trait_make::make(Send)] /// Path based filesystem trait. /// /// # Notes: diff --git a/src/raw/filesystem.rs b/src/raw/filesystem.rs index d961ea7..c33bf14 100644 --- a/src/raw/filesystem.rs +++ b/src/raw/filesystem.rs @@ -1,6 +1,5 @@ use std::ffi::OsStr; -use async_trait::async_trait; use bytes::Bytes; use futures_util::stream::Stream; @@ -10,7 +9,7 @@ use crate::raw::request::Request; use crate::{Inode, Result, SetAttr}; #[allow(unused_variables)] -#[async_trait] +#[trait_make::make(Send)] /// Inode based filesystem trait. /// /// # Notes: diff --git a/src/raw/request.rs b/src/raw/request.rs index ef75375..52ed783 100644 --- a/src/raw/request.rs +++ b/src/raw/request.rs @@ -1,6 +1,6 @@ use crate::raw::abi::fuse_in_header; -#[derive(Debug, Default, Copy, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] /// Request data pub struct Request { /// the unique identifier of this request. diff --git a/src/raw/session.rs b/src/raw/session.rs index 9179ae7..a282a34 100644 --- a/src/raw/session.rs +++ b/src/raw/session.rs @@ -245,10 +245,9 @@ impl Session { task::spawn(async move { Self::reply_fuse(fuse_write_connection, receiver).await }) .fuse(); #[cfg(all(not(feature = "async-std-runtime"), feature = "tokio-runtime"))] - let reply_task = - task::spawn(Self::reply_fuse(fuse_write_connection, receiver)) - .fuse() - .map(Result::unwrap); + let reply_task = task::spawn(Self::reply_fuse(fuse_write_connection, receiver)) + .fuse() + .map(Result::unwrap); pin_mut!(reply_task);