No description
Find a file
2024-11-03 11:34:17 +00:00
.cargo build: switch to forgejo actions 2024-10-29 22:30:17 +00:00
.forgejo/workflows build: switch to forgejo actions 2024-10-29 22:30:17 +00:00
.git-hooks feat: initial empty library 2024-04-08 14:33:39 +01:00
src refactor(fs): use type aliases 2024-11-03 11:34:17 +00:00
tests feat: remove need for mutability 2024-11-02 20:02:52 +00:00
.git-next.toml build: Add .git-next.toml config file 2024-04-16 07:06:50 +01:00
.gitignore feat: initial empty library 2024-04-08 14:33:39 +01:00
.rgignore feat: initial empty library 2024-04-08 14:33:39 +01:00
bacon.toml feat: initial empty library 2024-04-08 14:33:39 +01:00
Cargo.toml test(fs): integration tests 2024-11-01 21:16:32 +00:00
justfile feat: remove need for mutability 2024-11-02 20:02:52 +00:00
LICENSE feat: initial empty library 2024-04-08 14:33:39 +01:00
README.md feat(fs): add copy 2024-11-03 11:34:17 +00:00
renovate.json chore(deps): prevent renovate creating pointless PRs 2024-04-27 14:29:48 +01:00

kxio

Provides injectable Filesystem and Network resources to make code more testable.

std::fs alternatives

  • std::fs::canonicalize - path(path).canonicalize() - Returns the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved.
  • 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.
  • std::fs::create_dir - dir(path).create() - Creates a new, empty directory at the provided path
  • std::fs::create_dir_all - dir(path).create_all() - Recursively create a directory and all of its parent components if they are missing.
  • std::fs::hard_link - link(path)create() - Creates a new hard link on the filesystem.
  • std::fs::metadata - path(path).metadata() - Given a path, query the file system to get information about a file, directory, etc.
  • std::fs::read - file(path).reader().bytes() - Read the entire contents of a file into a bytes vector.
  • std::fs::read_dir - 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_to_string - file(path).reader().to_string() - Read the entire contents of a file into a string.
  • std::fs::remove_dir - dir(path).remove() - Removes an empty directory.
  • std::fs::remove_dir_all - dir(path).remove_all() - Removes a directory at this path, after removing all its contents. Use carefully!
  • std::fs::remove_file - file(path).remove() - Removes a file from the filesystem.
  • std::fs::rename - 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::symlink_metadata - link(path).metadata() - Query the metadata about a file without following symlinks.
  • std::fs::write - file(path).write() - Write a slice as the entire contents of a file.

Network

The entire [network] module needs to be completly rewritten It's use is strongly discouraged. A new [net] module will likely be its replacement.