macro_rules! impl_shared_conversions { (convert $shared_type:ident from $unshared_trait:ident using $ctor:expr) => { ... }; }
Expand description
Implements FromUnshared
for a shared type.
See the shared
module docs for information about shared types.
ยงExample
use aws_smithy_runtime_api::impl_shared_conversions;
use std::sync::Arc;
trait Thing {}
struct Thingamajig;
impl Thing for Thingamajig {}
struct SharedThing(Arc<dyn Thing>);
impl Thing for SharedThing {}
impl SharedThing {
fn new(thing: impl Thing + 'static) -> Self {
Self(Arc::new(thing))
}
}
impl_shared_conversions!(convert SharedThing from Thing using SharedThing::new);