use std::{fs::FileType, path::PathBuf};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct File {
pub name: String,
pub path: PathBuf,
pub is_dir: bool,
pub is_hidden: bool,
pub file_type: Option<FileType>,
}
impl File {
#[inline]
#[must_use]
pub fn is_file(&self) -> bool {
self.file_type.is_some_and(|f| f.is_file())
}
#[allow(missing_docs)]
#[inline]
#[must_use]
#[deprecated(
since = "0.3.0",
note = "`name` field is public and should be acceded with `.name`"
)]
pub fn name(&self) -> &str {
&self.name
}
#[allow(missing_docs)]
#[inline]
#[must_use]
#[deprecated(
since = "0.3.0",
note = "`path` field is public and should be acceded with `.path`"
)]
pub const fn path(&self) -> &PathBuf {
&self.path
}
#[allow(missing_docs)]
#[inline]
#[must_use]
#[deprecated(
since = "0.3.0",
note = "`is_dir` field is public and should be acceded with `.is_dir`"
)]
pub const fn is_dir(&self) -> bool {
self.is_dir
}
#[allow(missing_docs)]
#[inline]
#[must_use]
#[deprecated(
since = "0.3.0",
note = "`is_hidden` field is public and should be acceded with `.is_hidden`"
)]
pub fn is_hidden(&self) -> bool {
self.is_hidden
}
#[allow(missing_docs)]
#[inline]
#[must_use]
#[deprecated(
since = "0.3.0",
note = "`file_type` field is public and should be acceded with `.file_type`"
)]
pub const fn file_type(&self) -> Option<FileType> {
self.file_type
}
}