#[arc_wrap]Expand description
Automatically wraps a struct with an Inner postfix in an Arc
This macro generates:
- A wrapper struct that contains
Arc<OriginalStructInner> - A
Cloneimplementation for the wrapper - A
Derefimplementation that derefs to the inner struct - A
newfunction that takes the inner struct and wraps it in Arc
§Example
ⓘ
use synapse_macros::arc_wrap;
#[arc_wrap]
pub struct MyService {
pub data: String,
pub count: u32,
}
// This generates:
// pub struct MyServiceInner { pub data: String, pub count: u32 }
// pub struct MyService(Arc<MyServiceInner>);
// impl Clone for MyService { ... }
// impl Deref for MyService { ... }
// impl MyService { pub fn new(inner: MyServiceInner) -> Self { ... } }