23 stable releases

2.0.4 Jul 31, 2020
2.0.2 May 22, 2020
1.2.10 Mar 15, 2020
1.2.2 Oct 31, 2019
1.0.2 Jul 13, 2019

#153 in Value formatting

24 downloads per month
Used in 7 crates

Apache-2.0

44KB
644 lines

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");
}

lib.rs:

This are Custom Enum codes 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 open_file(file_name: &str) -> FileOps {
    match std::fs::File::create(file_name) {
        Ok(_) => FileOps::CreateTrue,
        Err(_) => FileOps::CreateFalse,
    }
}

open_file("foo.txt");

Dependencies

~0.4–1MB
~22K SLoC