[][src]Macro alloc::setup_imports

macro_rules! setup_imports {
    (@reordered $std:meta, $alloc:meta, $futures:meta ) => { ... };
    (@reorder
        ({}, $alloc:tt, $futures:tt)
        std: $std:meta,
        $( $tail:tt )*
    ) => { ... };
    (@reorder
        ($std:tt, {}, $futures:tt)
        alloc: $alloc:meta,
        $( $tail:tt )*
    ) => { ... };
    (@reorder
        ($std:tt, $alloc:tt, {})
        futures: $futures:meta,
        $( $tail:tt )*
    ) => { ... };
    (@reorder
        ({$std:meta}, {$alloc:meta}, {$futures:meta})
    ) => { ... };
    (@reorder
        ({$std:meta}, {$alloc:meta}, {})
    ) => { ... };
    ($($featname:ident : $cond:meta),* $(,)* ) => { ... };
}

Create the alloc api facade

This will add the extern crate declaration for the alloc crate and set up the facade module at crate::alloc. It should contain an identical API surface for both std and alloc uses.

Example

This example is not tested
#![cfg_attr(not(feature = "std"), no_std)]

// Each of std, alloc, and futures should be followed by a "meta" item.
// This will be used for the proper #[cfg(...)] attributes.
// They can be in any order. futures is optional, and will default to
// "always disabled". You can use "all()" for "always enabled" on any of them.
alloc::setup_imports! {
    std: feature = "std",
    alloc: feature = "alloc",
    futures: feature = "futures",
}