arcstr
arcstr copied to clipboard
Atomic swap?
I would like to update an ArcStr atomically. Is it possible to implement some wrapper like arc_swap for arcstr, or must that introduce significant overhead?
It seems that we can make arcstr have an optional feature arc-swap that implements the arc_swap::RefCnt trait, and ArcSwapAny<ArcStr> can immediately work.
I can try to implement this if the proposal is approved.
Yeah, that would be fine, since they seem fairly semver-stable. If there are issues I can take a stab at it as well.
The feature should be called arc_swap though, e.g. it should just be
[dependencies]
arc_swap = { version = "1", optional = true }
Also you should note in the docs for this feature it should mention that turning this feature on requires libstd (arc_swap is not no_std).
The package name is arc-swap nor arc_swap.
Sorry, it appears that arc-swap does not really support fat pointers, and using ArcSwapAny<ArcStr> is not really fasible.
Sorry, it appears that arc-swap does not really support fat pointers, and using ArcSwapAny<ArcStr> is not really fasible.
Hm, Worth noting that only the pointee is fat, ArcStr itself is not. But maybe they don't handle that possibility.
When I have time I'll read up on the algorithm and see if its feasible to implement a less-involved version (likely less performant too, unless the fact that we have no weak or mutable data can be leveraged) of it behind a feature or something.