JanKaul commented on issue #3:
URL: https://github.com/apache/iceberg-rust/issues/3#issuecomment-1661524204

   I just found a serde feature which might simplify the 
serialization/deserialization for in-memory/on-disk types. Serde let's you you 
define a "from" type which specifies that the annotated type first get's 
deserialized into the "from" type and then converted using the `From` 
implementation. And it works similarly with an "into" type. This would allow 
something like the following:
   
   ```rust
   /// In memory type
   #[serde(from = "TableMetadataUnion", into = "TableMetadataUnion")]
   struct TableMetadata {}
   
   impl From<TableMetadataUnion> for TableMetadata {}
   
   impl Into<TableMetadataUnion> for TableMetadata {}
   
   /// on disk types
   enum TableMetadataUnion {
      V1(TableMetadataV1),
      V2(TableMetadataV2)
   }
   
   struct TableMetadataV1 {}
   
   struct TableMetadataV2 {}
   ```
   
   What do you think?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to