extensions-rs

Crates.ioextensions-rs
lib.rsextensions-rs
version0.2.1
sourcesrc
created_at2024-02-29 21:15:58.267087
updated_at2024-03-04 17:04:55.848715
descriptionFile extension types in Rust
homepagehttps://github.com/travisbaars/extensions-rs
repositoryhttps://github.com/travisbaars/extensions-rs
max_upload_size
id1158185
size17,544
Travis Baars (travisbaars)

documentation

https://docs.rs/extensions-rs

README

extensions-rs

GitHub Actions Workflow Status Crates.io Version docs.rs

A collection of file extension types in Rust.

The idea behind this crate is to give a simple way of handling file extension types.

Installation

Simply add extensions-rs to the dependencies your Cargo.toml file:

[dependencies]
extensions-rs = "0.2.1"

Or use the cargo add command:

cargo add extensions-rs

Examples

Conversion to Extension type:

use extensions_rs::Extension;
use extensions_rs::Image;

assert_eq!("png", Extension::to_str(Extension::Image(Image::ExtPNG)));

Simple conversion, &str to Image type:

use extensions_rs::ext::Image;

assert_eq!(Image::ExtJPG, Image::from("jpg"))

Validate extension:

use extensions_rs::utils::Validate;

assert_eq!(true, Validate::check_str("jpg"))

Todo

  • Improve extension coverage
    • Add text extensions
    • Add video extensions
    • Add archive extensions
    • Add programming extensions
    • Add document extensions
  • Improve documentation
  • Implement to_str for Image
  • Add feature to take a whole path or string and convert it to correct type
  • Remove unnecessary `async' funcion/methods. Possibly transition to alternate async options.
Commit count: 0

cargo fmt