use std::io::{Error, ErrorKind, Result};
use std::time::SystemTime;
use crate::FileType;
pub struct Metadata {
pub(crate) ty: FileType,
pub(crate) len: u64,
}
impl Metadata {
pub fn accsessed(&self) -> Result<SystemTime> {
Err(Error::from(ErrorKind::Other))
}
pub fn created(&self) -> Result<SystemTime> {
Err(Error::from(ErrorKind::Other))
}
pub fn file_type(&self) -> FileType {
self.ty
}
pub fn is_dir(&self) -> bool {
self.ty.is_dir()
}
pub fn is_file(&self) -> bool {
self.ty.is_file()
}
pub fn is_symlink(&self) -> bool {
self.ty.is_symlink()
}
pub fn len(&self) -> u64 {
self.len
}
pub fn modified(&self) -> Result<SystemTime> {
Err(Error::from(ErrorKind::Other))
}
pub fn permissions(&self) -> Permissions {
Permissions { readonly: false }
}
}
pub struct Permissions {
readonly: bool,
}
impl Permissions {
pub fn readonly(&self) -> bool {
self.readonly
}
pub fn set_readonly(&mut self, readonly: bool) {
self.readonly = readonly
}
}