evmap
evmap copied to clipboard
Implement Serialize for MapReadRef
This solves #2
I tried also implementing serde::Deserialize
for (WriteHandle, ReadHandle)
but apparently implementing a foreign trait on a tuple with generic structs violates the orphan rule.
note that this can't be collected into a Hashmap<K,V>
but into a HashMap<K, Vec<V>>
Codecov Report
Merging #8 (a2f55b0) into master (557feab) will decrease coverage by
2.48%
. The diff coverage is0.00%
.
Impacted Files | Coverage Δ | |
---|---|---|
src/read/read_ref.rs | 54.16% <0.00%> (-6.30%) |
:arrow_down: |
src/values.rs | 79.50% <0.00%> (-6.22%) |
:arrow_down: |
Should I enable the serde
feature in the CI?
Should I write some tests for this? (I didn't write because that will require deciding which dependency to use, serde_json or a more complex serde_test suite)
This is great, thanks!
For Deserialize
, I wonder if we can't just implement it for WriteHandle
specifically. It should be possible to get a new ReadHandle
given just a WriteHandle
, so as long as we can deserialize into a WriteHandle
, that should get you most of the way. The implementation is (hopefully) also very simply — just deserialize into a HashMap
with the appropriate key/value type, and then turn that into a WriteHandle
+ ReadHandle
, and then drop the ReadHandle
.
For
Deserialize
, I wonder if we can't just implement it forWriteHandle
specifically. It should be possible to get a newReadHandle
given just aWriteHandle
I thought about doing that but assumed it's not correct, because all the current constructors return both a write and read handles.
Ah, no, that should be entirely correct!