Possible breaking change - remove unnecessary Arcs?
Proposal
Currently, lots of Arc
s are used in both arguments and return types of object constructors. For example, HsCircPool
is built using:
fn new(circmgr: &Arc<CircMgr<R>>) -> Arc<Self>;
However, this is quite unnecessary considering CircMgr
's own documentation says it's just a handle, and indeed it already uses arcs internally, so this extra layer of arcs seems to be useless. In fact, the first thing that happens in the constructor is cloning the arc that was just passed, and the return type being an arc is just because the constructor is being wrapped in one:
Arc::new(Self {
circmgr,
launcher_handle: OnceCell::new(),
inner: Mutex::new(Inner { pool }),
})
which seems to be pointless as the caller can just wrap it in an arc themselves if they so choose, as well as the fact that HsCircPool is already Send + Sync with cheap copies because it too uses arcs internally for everything. I would like to work on a merge request to remove these redundant arcs from every library - however, this would be a breaking change, so I'm wondering if it is fine to do so right now, if I should wait a bit or if the best way forward is to remove it in a non-breaking way (e.g. new "arcless" APIs, just removing them internally while keeping function sigs the same or using some hack with "impl Deref" to make sure arc-wrapped arguments still work).