crepererum commented on PR #7160:
URL: https://github.com/apache/arrow-rs/pull/7160#issuecomment-2671069353
I would prefer if we don't use `Any` directly for the extensions but a
proper trait. This also allows you to properly implement `Debug` and even
`PartialEq`:
```rust
trait Extension: std::fmt::Debug {
fn as_any(&self) -> &dyn std::any::Any;
fn partial_eq(&self, other: &dyn std::any::Any) -> bool;
}
#[derive(Debug, PartialEq)]
struct MyExt {
x: u8,
}
impl Extension for MyExt {
fn as_any(&self) -> &dyn std::any::Any {
self
}
fn partial_eq(&self, other: &dyn std::any::Any) -> bool {
other
.downcast_ref::<Self>()
.map(|other| other.partial_eq(self))
.unwrap_or_default()
}
}
```
--
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]