kenba/opencl3

Implement Serde's Serialize, Deserialize for SvmVec

Closed this issue · 4 comments

kenba commented

The Rust API Guidelines recommend that "Types that play the role of a data structure should implement Serialize and Deserialize", see: C-SERDE. Therefore, SvmVec should implement the serde Serialize and Deserialize traits.

kenba commented

I have been able to implement Serialize for SvmVec. However, I cannot determine how to implement Deserialize for SvmVec because the Deserialize method signature only takes a Deserializer parameter. However, it needs to take an additional Context parameter to allocate the SvmVec memory.

Has anyone got any ideas how to implement Deserialize for SvmVec?

kenba commented

Thank you Jonathan, DeserializeSeed looks perfect!

kenba commented

Added ExtendSvmVec DeserializeSeed implementation for SvmVec and opencl2serde.rs example file in version 0.6.2 of the library.