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
I'm using the map.rs file in my personal project today, and I made some changes that may be useful for the upstream:
impl<K,V>From<MapImpl<K,V>>forMap<K,V>{fnfrom(map:MapImpl<K,V>) -> Self{Map{ map }}}implMap<String,Value>{/// Consumes the `Map`, returning the underlying Map implementation.pubfninto_inner(self) -> MapImpl{self.map}/// Gets an iterator over the values of the map.#[inline]pubfninto_values(self) -> IntoValues{IntoValues{iter:self.map.into_values(),}}}/// An owning iterator over a serde_json::Map's values.pubstructIntoValues{iter:IntoValuesImpl,}#[cfg(not(feature = "preserve_order"))]typeIntoValuesImpl = btree_map::IntoValues<String,Value>;#[cfg(feature = "preserve_order")]typeIntoValuesImpl = indexmap::map::IntoValues<String,Value>;delegate_iterator!((IntoValues) => Value);
I'm willing to send a PR if this is desired to be included in the upstream.
Besides, the clippy workaround for derivable_impls seems resolved now. I remove it and no more new warnings.
The text was updated successfully, but these errors were encountered:
into_values would be fine. The other 2 APIs in your suggestion would be misguided to add in serde_json. Either of those makes indexmap upgrades such as #1031 only doable across a major version of serde_json which is too disruptive.
I found this patch when developing SPath (a JSONPath impl), while I later noticed that I can write a trait rather than making another Value struct.
Such an into_xxx function reminds me of the other PR I made Impl String::into_chars rust-lang/rust#133057. I just often find that if we can take the ownership, we can save a clone. But generally speaking, "move"s are often/always "memcpy" in Rust?
Hi @dtolnay!
I'm using the
map.rs
file in my personal project today, and I made some changes that may be useful for the upstream:I'm willing to send a PR if this is desired to be included in the upstream.
Besides, the clippy workaround for derivable_impls seems resolved now. I remove it and no more new warnings.
The text was updated successfully, but these errors were encountered: