crepererum commented on code in PR #8558:
URL: https://github.com/apache/arrow-rs/pull/8558#discussion_r2405693299
##########
arrow-schema/src/extension/canonical/fixed_shape_tensor.rs:
##########
@@ -141,6 +144,144 @@ pub struct FixedShapeTensorMetadata {
permutations: Option<Vec<usize>>,
}
+impl Serialize for FixedShapeTensorMetadata {
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ let mut state =
serializer.serialize_struct("FixedShapeTensorMetadata", 3)?;
+ state.serialize_field("shape", &self.shape)?;
+ state.serialize_field("dim_names", &self.dim_names)?;
+ state.serialize_field("permutations", &self.permutations)?;
+ state.end()
+ }
+}
+
+impl<'de> Deserialize<'de> for FixedShapeTensorMetadata {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ #[derive(Debug)]
Review Comment:
my guess is that this is auto-generated code. I personally would prefer if
we wouldn't nest structs/enums/impls/etc. into methods. It makes the code
rather hard to read (for auto-generated code there are usually good reasons why
this is done this way, e.g. due to shadowing).
--
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]