chaokunyang commented on PR #2712: URL: https://github.com/apache/fory/pull/2712#issuecomment-3376703013
@urlyy it's a little inconvenient, but it's necessary. We can't provide a blanket impl for `ForyDefault` trait to forward to rust `Default` trait, due to the limit that we can't provide `default` for `Rc<dyn Any>`. You can provide a new macro `ForyDefault` which can be used to generate `ForyDefault` impl for a ext type. The impl can check whether `Default` is implemented. If true, then forward to that trait, otherwise, let `ForyDefault` to generate both `ForyDefault` and `Default` impl, which is exactly `ForyObject` did. For `fn as_any(&self) -> &dyn std::any::Any`, I think it's acceptable, not too much code for user to write -- 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]
