Skip to main content

FromChain

Derive Macro FromChain 

Source
#[derive(FromChain)]
{
    // Attributes available to this derive:
    #[from]
}
Expand description

Implement ::std::convert::From through a chain of intermediate types.

ยงExample

#[derive(FromChain)]
#[from(Foo, Bar, Baz)]
struct MyStruct;

adds

impl From<Foo> for MyStruct {
    fn from(foo: Foo) -> Self {
        Self::from(Baz::from(Bar::from(foo)))
    }
}