[][src]Macro rfc::PromiseTransmutableInto

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

Derive macro generating an impl of the trait PromiseTransmutableFrom.

To promise that all safe transmutations from your type into other PromiseTransmutableFrom types will remain safe 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 `PromiseTransmutableInto` for `Foo`
const _: () = {
    use core::convert::transmute::stability::PromiseTransmutableInto;
 
    #[repr(C)]
    pub struct TransmutableIntoArchetype(
        pub <Bar as PromiseTransmutableInto>::Archetype,
        pub <Baz as PromiseTransmutableInto>::Archetype,
    );
 
    impl PromiseTransmutableInto for TransmutableIntoArchetype { type Archetype = Self };
 
    impl PromiseTransmutableInto for Foo {
        type Archetype = TransmutableIntoArchetype;
    }
};