1use std::io::{Error, ErrorKind, Result};
2use std::time::SystemTime;
3
4use crate::FileType;
5
6pub struct Metadata {
7 pub(crate) ty: FileType,
8 pub(crate) len: u64,
9}
10
11impl Metadata {
12 pub fn accsessed(&self) -> Result<SystemTime> {
14 Err(Error::from(ErrorKind::Other))
15 }
16 pub fn created(&self) -> Result<SystemTime> {
18 Err(Error::from(ErrorKind::Other))
19 }
20 pub fn file_type(&self) -> FileType {
22 self.ty
23 }
24 pub fn is_dir(&self) -> bool {
25 self.ty.is_dir()
26 }
27 pub fn is_file(&self) -> bool {
28 self.ty.is_file()
29 }
30 pub fn is_symlink(&self) -> bool {
32 self.ty.is_symlink()
33 }
34 pub fn len(&self) -> u64 {
35 self.len
36 }
37 pub fn modified(&self) -> Result<SystemTime> {
39 Err(Error::from(ErrorKind::Other))
40 }
41 pub fn permissions(&self) -> Permissions {
42 Permissions { readonly: false }
43 }
44}
45
46pub struct Permissions {
47 readonly: bool,
48}
49
50impl Permissions {
51 pub fn readonly(&self) -> bool {
52 self.readonly
53 }
54 pub fn set_readonly(&mut self, readonly: bool) {
55 self.readonly = readonly
56 }
57}