Add conversion functions for FileType from fuser
This commit is contained in:
parent
13c2904f6d
commit
9163bff990
|
@ -868,6 +868,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"fuser",
|
||||||
"log",
|
"log",
|
||||||
"quinn",
|
"quinn",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -27,7 +27,7 @@ clap = { version = "3.0.7", features = ["derive"] }
|
||||||
quinn = { version = "0.8.0", features = [] }
|
quinn = { version = "0.8.0", features = [] }
|
||||||
|
|
||||||
# Compression and Encryption
|
# Compression and Encryption
|
||||||
zstd = "0.9.2+zstd.1.5.1"
|
zstd = "0.9.2"
|
||||||
sodiumoxide = "0.2.7"
|
sodiumoxide = "0.2.7"
|
||||||
rustls = "0.20.2"
|
rustls = "0.20.2"
|
||||||
|
|
||||||
|
|
|
@ -23,4 +23,6 @@ toml = "0.5.8"
|
||||||
quinn = { version = "0.8.0", features = [] }
|
quinn = { version = "0.8.0", features = [] }
|
||||||
|
|
||||||
# Compression and Encryption
|
# Compression and Encryption
|
||||||
zstd = "0.9.2+zstd.1.5.1"
|
zstd = "0.9.2"
|
||||||
|
|
||||||
|
fuser = { version = "0.10.0", optional = true }
|
||||||
|
|
|
@ -67,6 +67,9 @@ pub enum FileKind {
|
||||||
Socket,
|
Socket,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "fuser")]
|
||||||
|
mod messages_fuser;
|
||||||
|
|
||||||
/// Copy of fuser's FileAttr. Used to describe a file.
|
/// Copy of fuser's FileAttr. Used to describe a file.
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct FileMetadata {
|
pub struct FileMetadata {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
use crate::messages::FileKind;
|
||||||
|
use fuser::FileType;
|
||||||
|
use std::fs::FileType;
|
||||||
|
|
||||||
|
impl From<FileType> for FileKind {
|
||||||
|
fn from(filetype: FileType) -> Self {
|
||||||
|
match filetype {
|
||||||
|
FileType::NamedPipe => FileKind::NamedPipe,
|
||||||
|
FileType::CharDevice => FileKind::CharDevice,
|
||||||
|
FileType::BlockDevice => FileKind::BlockDevice,
|
||||||
|
FileType::Directory => FileKind::Directory,
|
||||||
|
FileType::RegularFile => FileKind::RegularFile,
|
||||||
|
FileType::Symlink => FileKind::Symlink,
|
||||||
|
FileType::Socket => FileKind::Socket,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<FileType> for FileKind {
|
||||||
|
fn into(self) -> FileType {
|
||||||
|
match self {
|
||||||
|
FileKind::NamedPipe => FileType::NamedPipe,
|
||||||
|
FileKind::CharDevice => FileType::CharDevice,
|
||||||
|
FileKind::BlockDevice => FileType::BlockDevice,
|
||||||
|
FileKind::Directory => FileType::Directory,
|
||||||
|
FileKind::RegularFile => FileType::RegularFile,
|
||||||
|
FileKind::Symlink => FileType::Symlink,
|
||||||
|
FileKind::Socket => FileType::Socket,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ clap = { version = "3.0.7", features = ["derive"] }
|
||||||
quinn = { version = "0.8.0", features = [] }
|
quinn = { version = "0.8.0", features = [] }
|
||||||
|
|
||||||
# Compression and Encryption
|
# Compression and Encryption
|
||||||
zstd = "0.9.2+zstd.1.5.1"
|
zstd = "0.9.2"
|
||||||
rustls = "0.20.2"
|
rustls = "0.20.2"
|
||||||
rcgen = { version = "0.8.14", features = ["x509-parser"] }
|
rcgen = { version = "0.8.14", features = ["x509-parser"] }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue