ll-rs 0.1.0

A small ls -l clone in rust with colors!
Documentation
extern crate libc;

use chrono::{DateTime, Local};
//use libc::{S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR};
use std::os::unix::fs::PermissionsExt;
use std::{error::Error, path::PathBuf};

#[derive(Debug)]
pub struct Entry {
    is_dir: bool,
    mode: u32,
    size: f64,
    modified: DateTime<Local>,
    path: PathBuf,
}

impl Entry {
    pub fn new(path: PathBuf) -> Result<Self, Box<dyn Error>> {
        if !path.exists() {
            return Err(Box::from(format!(
                "Path doesn't exists or syslink is broken. Path: {:?}",
                path
            )));
        }
        let metadata = path.metadata()?;
        let is_dir = metadata.is_dir();
        let mode = metadata.permissions().mode();
        let size = metadata.len() as f64;
        let modified: DateTime<Local> = DateTime::from(metadata.modified()?);

        Ok(Self {
            is_dir,
            mode,
            size,
            modified,
            path,
        })
    }
}