[][src]Macro rfc::PromiseTransmutableFrom

macro_rules! PromiseTransmutableFrom {
    ($item:item) => { ... };
}

Derive macro generating an impl of the trait PromiseTransmutableFrom.

To promise that all transmutations of any PromiseTransmutableInto type into your type that are currently safe will remain so in the future, simply annotate your type with #[derive(PromiseTransmutableFrom)].

For instance, this:

#[derive(PromiseTransmutableFrom)]
#[repr(C)]
pub struct Foo(pub Bar, pub Baz);

will expand to this:

/// Generated `PromiseTransmutableFrom` for `Foo`
const _: () = {
    use core::convert::transmute::stability::PromiseTransmutableFrom;
 
    #[repr(C)]
    pub struct TransmutableFromArchetype(
        pub <Bar as PromiseTransmutableFrom>::Archetype,
        pub <Baz as PromiseTransmutableFrom>::Archetype,
    );
 
    impl PromiseTransmutableFrom for TransmutableFromArchetype { type Archetype = Self };
 
    impl PromiseTransmutableFrom for Foo {
        type Archetype = TransmutableFromArchetype;
    }
};