All Projects → ihrwein → enum-display-derive

ihrwein / enum-display-derive

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
Derive Display for simple enums automagically

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to enum-display-derive

hypergraph
Hypergraph is data structure library to create a directed hypergraph in which a hyperedge can join any number of vertices.
Stars: ✭ 205 (+831.82%)
Mutual labels:  rustlang
rust-for-backend-development
SWITCH TO RUST AND STOP WASTING YOUR TIME WITH JAVASCRIPT RUNTIME EXCEPTIONS
Stars: ✭ 30 (+36.36%)
Mutual labels:  rustlang
rust-advent
Learning Rust by solving advent of code challenges (Streaming live on Twitch every Monday)
Stars: ✭ 20 (-9.09%)
Mutual labels:  rustlang
image-hub
Image Hub is a sample application for exploring WebAssembly modules used as Envoy filters.
Stars: ✭ 56 (+154.55%)
Mutual labels:  rustlang
goprisma
A Go wrapper for prisma to turn databases into GraphQL APIs using Go.
Stars: ✭ 54 (+145.45%)
Mutual labels:  rustlang
Node
MASQ combines the benefits of VPN and Tor technology to create a superior next-generation privacy software, where users are rewarded for supporting an uncensored global web. Users gain privacy and anonymity online, while helping promote Internet Freedom.
Stars: ✭ 123 (+459.09%)
Mutual labels:  rustlang
rust-wasm-webpack
A simple boilerplate to get WebAssembly (WASM) code generated by Rust and bundled by Webpack!
Stars: ✭ 88 (+300%)
Mutual labels:  rustlang
webbrowser-rs
Rust library to open URLs in the web browsers available on a platform
Stars: ✭ 150 (+581.82%)
Mutual labels:  rustlang
Rustup
The Rust toolchain installer
Stars: ✭ 4,394 (+19872.73%)
Mutual labels:  rustlang
coding-challenge
Algorithms and Data-structures, problems and solutions in Rust language using cargo-workspaces
Stars: ✭ 17 (-22.73%)
Mutual labels:  rustlang
taileater
A puzzle game where you eat your own tail to win!
Stars: ✭ 19 (-13.64%)
Mutual labels:  rustlang
flowd
An inter-language runtime for flow-based programming (FBP)
Stars: ✭ 18 (-18.18%)
Mutual labels:  rustlang
headlines
[WIP] A simple news reading GUI app built in Rust
Stars: ✭ 92 (+318.18%)
Mutual labels:  rustlang
lambda-rust
🐳 🦀 a dockerized lambda build env for rust applications
Stars: ✭ 148 (+572.73%)
Mutual labels:  rustlang
wasmbin
A self-generating WebAssembly parser & serializer in Rust.
Stars: ✭ 40 (+81.82%)
Mutual labels:  rustlang
WorkingGroup
Issues tracker for ideas, ongoing work, looking for mentors, mentors available. Join here!
Stars: ✭ 37 (+68.18%)
Mutual labels:  rustlang
easy reader
⏮ ⏯ ⏭ A Rust library for easily navigating forward, backward or randomly through the lines of huge files.
Stars: ✭ 83 (+277.27%)
Mutual labels:  rustlang
qrrs
CLI QR code generator and reader written in rust
Stars: ✭ 29 (+31.82%)
Mutual labels:  rustlang
pdu
Small, fast, and correct L2/L3/L4 packet parser.
Stars: ✭ 34 (+54.55%)
Mutual labels:  rustlang
nativeshell
Experimental embedder for Flutter
Stars: ✭ 553 (+2413.64%)
Mutual labels:  rustlang

Derive Display trait for enums

Build Status crates.io

Documentation

This crate can derive a Display implementation for very simple enums, like the following one:

#[macro_use]
extern crate enum_display_derive;

use std::fmt::Display;

#[derive(Display)]
enum FizzBuzz {
   Fizz,
   Buzz,
   FizzBuzz,
   Number(u64),
}

fn fb(i: u64) -> FizzBuzz {
   match (i % 3, i % 5) {
       (0, 0) => FizzBuzz::FizzBuzz,
       (0, _) => FizzBuzz::Fizz,
       (_, 0) => FizzBuzz::Buzz,
       (_, _) => FizzBuzz::Number(i),
   }
}

fn main() {
   for i in 0..100 {
       println!("{}", fb(i));
   }
}

You should see the following output:

FizzBuzz
1
2
Fizz
4
Buzz
Fizz
7
...

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.`

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].