Crates.io | extensions-rs |
lib.rs | extensions-rs |
version | 0.2.1 |
source | src |
created_at | 2024-02-29 21:15:58.267087 |
updated_at | 2024-03-04 17:04:55.848715 |
description | File extension types in Rust |
homepage | https://github.com/travisbaars/extensions-rs |
repository | https://github.com/travisbaars/extensions-rs |
max_upload_size | |
id | 1158185 |
size | 17,544 |
A collection of file extension types in Rust.
The idea behind this crate is to give a simple way of handling file extension types.
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
Extension
type:use extensions_rs::Extension;
use extensions_rs::Image;
assert_eq!("png", Extension::to_str(Extension::Image(Image::ExtPNG)));
&str
to Image
type:use extensions_rs::ext::Image;
assert_eq!(Image::ExtJPG, Image::from("jpg"))
use extensions_rs::utils::Validate;
assert_eq!(true, Validate::check_str("jpg"))
to_str
for Image
path
or string
and convert it to correct type