docs(fs): make it clearer what the std::fs functions map to
This commit is contained in:
parent
ecb61490f7
commit
abd854f749
1 changed files with 25 additions and 16 deletions
|
@ -29,23 +29,32 @@
|
||||||
//!
|
//!
|
||||||
//! # Standard library equivalents
|
//! # Standard library equivalents
|
||||||
//!
|
//!
|
||||||
//! - [x] `std::fs::canonicalize` - `path(path).canonicalize()` - Returns the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved.
|
//! Given a `FileSystem` `fs`:
|
||||||
//! - [x] `std::fs::copy` - `file(path).copy(target)` - Copies the contents of one file to another. This function will also copy the permission bits of the original file to the destination file.
|
//!
|
||||||
//! - [x] `std::fs::create_dir` - `dir(path).create()` - Creates a new, empty directory at the provided path
|
//! ```no_run
|
||||||
//! - [x] `std::fs::create_dir_all` - `dir(path).create_all()` - Recursively create a directory and all of its parent components if they are missing.
|
//! let fs = kxio::fs::temp().expect("temp fs"); // for testing
|
||||||
//! - [x] `std::fs::hard_link` - `file(path).hard_link(other)` - Creates a new hard link on the filesystem.
|
//! // or
|
||||||
//! - [x] `std::fs::metadata` - `path(path).metadata()` - Given a path, query the file system to get information about a file, directory, etc.
|
//! # let pathbuf = fs.base().join("foo").to_path_buf();
|
||||||
//! - [x] `std::fs::read` - `file(path).reader().bytes()` - Read the entire contents of a file into a bytes vector.
|
//! let fs = kxio::fs::new(pathbuf);
|
||||||
//! - [x] `std::fs::read_dir` - `dir(path).read()` - Returns an iterator over the entries within a directory.
|
//! ```
|
||||||
|
//!
|
||||||
|
//! - [x] `std::fs::canonicalize` - `fs.path(path).canonicalize()` - Returns the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved.
|
||||||
|
//! - [x] `std::fs::copy` - `fs.file(path).copy(target)` - Copies the contents of one file to another. This function will also copy the permission bits of the original file to the destination file.
|
||||||
|
//! - [x] `std::fs::create_dir` - `fs.dir(path).create()` - Creates a new, empty directory at the provided path
|
||||||
|
//! - [x] `std::fs::create_dir_all` - `fs.dir(path).create_all()` - Recursively create a directory and all of its parent components if they are missing.
|
||||||
|
//! - [x] `std::fs::hard_link` - `fs.file(path).hard_link(other)` - Creates a new hard link on the filesystem.
|
||||||
|
//! - [x] `std::fs::metadata` - `fs.path(path).metadata()` - Given a path, query the file system to get information about a file, directory, etc.
|
||||||
|
//! - [x] `std::fs::read` - `fs.file(path).reader().bytes()` - Read the entire contents of a file into a bytes vector.
|
||||||
|
//! - [x] `std::fs::read_dir` - `fs.dir(path).read()` - Returns an iterator over the entries within a directory.
|
||||||
//! - [ ] `std::fs::read_link` - `link(path).read()` - Reads a symbolic link, returning the file that the link points to.
|
//! - [ ] `std::fs::read_link` - `link(path).read()` - Reads a symbolic link, returning the file that the link points to.
|
||||||
//! - [x] `std::fs::read_to_string` - `file(path).reader().to_string()` - Read the entire contents of a file into a string.
|
//! - [x] `std::fs::read_to_string` - `fs.file(path).reader().to_string()` - Read the entire contents of a file into a string.
|
||||||
//! - [x] `std::fs::remove_dir` - `dir(path).remove()` - Removes an empty directory.
|
//! - [x] `std::fs::remove_dir` - `fs.dir(path).remove()` - Removes an empty directory.
|
||||||
//! - [x] `std::fs::remove_dir_all` - `dir(path).remove_all()` - Removes a directory at this path, after removing all its contents. Use carefully!
|
//! - [x] `std::fs::remove_dir_all` - `fs.dir(path).remove_all()` - Removes a directory at this path, after removing all its contents. Use carefully!
|
||||||
//! - [x] `std::fs::remove_file` - `file(path).remove()` - Removes a file from the filesystem.
|
//! - [x] `std::fs::remove_file` - `fs.file(path).remove()` - Removes a file from the filesystem.
|
||||||
//! - [x] `std::fs::rename` - `path(path).rename()` - Rename a file or directory to a new name, replacing the original file if to already exists.
|
//! - [x] `std::fs::rename` - `fs.path(path).rename()` - Rename a file or directory to a new name, replacing the original file if to already exists.
|
||||||
//! - [ ] `std::fs::set_permissions` - `path(path).set_permissions()` - Changes the permissions found on a file or a directory.
|
//! - [ ] `std::fs::set_permissions` - `fs.path(path).set_permissions()` - Changes the permissions found on a file or a directory.
|
||||||
//! - [x] `std::fs::symlink_metadata` - `path(path).symlink_metadata()` - Query the metadata about a file without following symlinks.
|
//! - [x] `std::fs::symlink_metadata` - `fs.path(path).symlink_metadata()` - Query the metadata about a file without following symlinks.
|
||||||
//! - [x] `std::fs::write` - `file(path).write()` - Write a slice as the entire contents of a file.
|
//! - [x] `std::fs::write` - `fs.file(path).write()` - Write a slice as the entire contents of a file.
|
||||||
//!
|
//!
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue