file_system

Crates.iofile_system
lib.rsfile_system
version0.3.3
sourcesrc
created_at2023-01-15 12:22:14.412963
updated_at2023-01-24 11:44:47.173741
descriptionThey are very similar to DirectoryInfo and FileInfo of c#
homepage
repository
max_upload_size
id759436
size33,684
Karl (KByys)

documentation

README

Trait

pub trait DFile {
    fn new<P: AsRef<Path> + Display>(path: P) -> Self;
    fn name(&self) -> &str;
    fn full_name(&self) -> &str;
    fn is_exist(&self) -> bool;
    fn is_read_only(&self) -> bool;
    fn create_self(&self) -> io::Result<()>;
    fn delete_self(&self) -> io::Result<()>;
    fn rename<N: AsRef<Path> + Display>(&mut self, new_name: N) -> io::Result<()>;
    fn move_with_new_name<P: AsRef<Path> + Display>(&mut self, path: P) -> io::Result<()>;
    fn move_to<P: AsRef<Path> + Display>(&mut self, path: P) -> io::Result<()>;
    fn copy_with_new_name<P: AsRef<Path> + Display>(&mut self, path: P) -> io::Result<()>;
    fn copy_to<P: AsRef<Path> + Display>(&mut self, path: P) -> io::Result<()>;
    fn size_bytes(&self) -> io::Result<u64>;
    fn size_kb(&self) -> io::Result<u64>;
    fn size_mb(&self) -> io::Result<u64>;
    fn to_dfile(&self) -> Dfile;
    fn get_parent(&self) -> DirectoryInfo;
    fn get_parent_path(&self) -> String;
    fn add_path<P: AsRef<Path> + Display>(&mut self, path: P);
}

Struct

pub struct DF;
pub struct FileInfo;
pub struct DirectoryInfo;
pub struct Dfile;

Enum

pub enum DFtype;

Usage

use file_system::*;
fn main() {
    let dir = DirectoryInfo::new("directory_path");
    let file = FileInfo::new("file_path");
    let dfile = Dfile::new("dir_or_file_path");
}
Commit count: 0

cargo fmt