custom_codes

Crates.iocustom_codes
lib.rscustom_codes
version2.0.4
sourcesrc
created_at2019-07-05 06:46:41.307125
updated_at2020-07-31 07:18:05.425668
descriptionSimple uniform response and error codes backed by enums
homepagehttps://github.com/charleschege/custom_codes
repositoryhttps://github.com/charleschege/custom_codes
max_upload_size
id146437
size55,425
CharlesĀ·Chege (charleschege)

documentation

README

custom_codes

This are Custom Enums for memorable and uniform response codes.

Enums are cheaper to compare and harder to get wrong than strings thereby guaranteeing efficiency.

Examples

Create codes for File Operations

use custom_codes::FileOps; 

fn create_file(file_name: &str) -> FileOps {
    match std::fs::File::create(file_name) {
        Ok(_) => FileOps::CreateTrue,
        Err(_) => FileOps::CreateFalse,
	}
}

fn main() {
	open("foo.txt");
}
Commit count: 110

cargo fmt