As a follow-up to #71, I would like to remove the Clone bound from Deserialize too. However, this requires a lot of other changes, so I'd like to discuss it here first.
The solution I'm thinking of is to duplicate a large part of the current API internally to be able to add items to a container while knowing that no Clone is actually called (there might be an alternative around a #[repr(transparent)] wrapper that implements Clone for anything and always panics, but then it's really hard to ensure that that impl is never used). That is, use something like UniqueArc and build UniqueVector, UniqueRRB, UniqueNode and such on top of it. Then FromIterator can use that to drop its Clone bound, and Deserialize doesn't need the Clone bound either anymore.
Wdyt?
As a follow-up to #71, I would like to remove the
Clonebound fromDeserializetoo. However, this requires a lot of other changes, so I'd like to discuss it here first.The solution I'm thinking of is to duplicate a large part of the current API internally to be able to add items to a container while knowing that no
Cloneis actually called (there might be an alternative around a#[repr(transparent)]wrapper that implementsClonefor anything and always panics, but then it's really hard to ensure that that impl is never used). That is, use something likeUniqueArcand buildUniqueVector,UniqueRRB,UniqueNodeand such on top of it. ThenFromIteratorcan use that to drop itsClonebound, andDeserializedoesn't need theClonebound either anymore.Wdyt?