You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The xsync.MapOf is a concurrent-safe map, but for use cases where a regular map is needed (e.g., serialization or interactions with non-concurrent code), it would be very convenient to have a built-in method for this conversion.
This would improve usability and reduce boilerplate code in user applications.
Currently, to convert an xsync.MapOf[K, V] to a regular Go map (map[K]V), I would have to manually iterate over the xsync.MapOf using the Range method, like so:
+1 on this. It would also help me in my unit tests, where I want to compare a result MapOf with an expected MapOf. If I can convert to regular maps, I can then use reflect.DeepCompare, without the need of a specific method .Equal()
The
xsync.MapOf
is a concurrent-safe map, but for use cases where a regular map is needed (e.g., serialization or interactions with non-concurrent code), it would be very convenient to have a built-in method for this conversion.This would improve usability and reduce boilerplate code in user applications.
Currently, to convert an
xsync.MapOf[K, V]
to a regular Go map(map[K]V)
, I would have to manually iterate over the xsync.MapOf using the Range method, like so:It would be helpful if the library could provide a utility method that simplifies this process, such as:
Is this safe to do? What do you think?
The text was updated successfully, but these errors were encountered: