[−][src]Trait pour::ConsCtx
A trait implemented by objects which can perform hash-consing on a map's internal data
Required methods
fn cons_arc(&mut self, inner: &Arc<InnerMap<K, V>>) -> Arc<InnerMap<K, V>>
Return an Arc<InnerMap>
with the same contents as the provided Arc
Correctness
The resulting Arc
should compare equal to inner
if they are comparable.
If not, being the result of clone
is fine.
fn cons(&mut self, inner: InnerMap<K, V>) -> Arc<InnerMap<K, V>>
Return an Arc<InnerMap>
with the same contents as the provided object.
Correctness
The resulting Arc
should compare equal to inner
if they are comparable.
If not, being the result of new
is fine.
Provided methods
fn cons_recursive(&mut self, inner: &Arc<InnerMap<K, V>>) -> Arc<InnerMap<K, V>>
Return an Arc<InnerMap>
with the same contents as the provided Arc
Note: this is provided as a separate function from cons_arc
to allow the user the choice as
to whether to perform deep or shallow hash-consing of mutated values: if shallow hash-consing
is desired, this method should just clone the input Arc
, whereas if deep hash-consing is
desired, this method should return another, potentially hash-consed Arc
. Deep hash-consing
is the default, so cons_arc
is called by the default implementation.
Correctness
The resulting Arc
should compare equal to inner
if they are comparable.
If not, being the result of clone
is fine.