archery icon indicating copy to clipboard operation
archery copied to clipboard

add `Clone` to `SharedPointerKind`'s constraints

Open phrohdoh opened this issue 1 year ago • 0 comments

I don't yet know enough to be able to determine whether this would break invariants that must be upheld.

Would it be possible & feasible to do this so that RcK & ArcK impl Clone?

I have a type (Value) and would like to derive/impl Clone for it:

pub enum Value<P: archery::SharedPointerKind> {
    Map(Map<P>),
}


#[derive(Debug, Clone)]
pub struct Map<P: SharedPointerKind>(pub(crate) RawMap<P>);

pub type RawMap<P> = rpds::HashTrieMap<Value<P>, Value<P>, P>;

To do so and actually make use of it like so, I have to add + Clone to all of my P: archery::SharedPointerKinds which results in an error because RcK & ArcK are not Clone.

Thank you for the excellent library!

phrohdoh avatar May 31 '23 14:05 phrohdoh