/procedurals

Collection of basic proc-macros

Primary LanguageRustMIT LicenseMIT

Procedurals

Crate docs.rs Build Status

Collection of basic proc-macros

IntoEnum

#[macro_use]
extern crate procedurals;

struct A {}
struct B {}

#[derive(IntoEnum)] // derives From<A> and From<B> for E
enum E {
    A(A),
    B(B),
}

EnumError

#[macro_use]
extern crate procedurals;
use std::{io, fmt};

#[derive(Debug, EnumError)] // EnumError derives From<*>, fmt::Display and error::Error
pub enum Error {
    IO(io::Error),
    Fmt(fmt::Error),
}

NewType

#[macro_use]
extern crate procedurals;

struct B {}

#[derive(NewType)] // NewType derives From<B>, Into<B>, Deref, and DerefMut
struct A(B);