rten-base 0.26.0

Shared utilities for the rten family of crates
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Utilities for defining `From` and `TryFrom` impls.

/// Define a `From` impl which creates an enum variant from a value.
#[macro_export]
macro_rules! enum_from {
    ($enum:ty, $variant:ident, $from:ty) => {
        impl From<$from> for $enum {
            fn from(val: $from) -> Self {
                Self::$variant(val)
            }
        }
    };
}

pub use enum_from;