impl_more

Macro impl_from_for_primitive

source
macro_rules! impl_from_for_primitive {
    ($this:ty; from $from:ty $(,)?) => { ... };
}
Expand description

Implement From for a primitive.

ยงExamples

With a newtype struct:

use impl_more::impl_from_for_primitive;

struct Checked(bool);
impl_from_for_primitive!(bool; from Checked);

let foo = bool::from(Checked(true));