[][src]Macro maybe_sync::dyn_maybe_send

macro_rules! dyn_maybe_send {
    ($($traits:tt)+) => { ... };
}

Expands to dyn $traits with Send marker trait added when "sync" feature is enabled.

Expands to dyn $traits without Send marker trait added "sync" feature is not enabled.

Example

fn foo<T: MaybeSend>(_: T) {}
// `x` will implement `MaybeSend` whether "sync" feature is enabled or not.
let x: Box<dyn_maybe_send!(std::future::Future<Output = u32>)> = Box::new(async move { 42 });
foo(x);