Seven-Streams opened a new pull request, #722:
URL: https://github.com/apache/tvm-ffi/pull/722

   Previously, structural_map / structural_mutate callbacks (closures, tuple 
chains, and #[dispatch(map)] / #[dispatch(mutate)] handlers) had to return Any 
or Result<Any>, forcing Any::from(...) wrapping at every return site.
   
   This PR relaxes IntoMapResult / IntoMutateResult into blanket impls over T: 
Into<Any>:
   
   impl<T: Into<Any>> IntoMapResult for T         { /* Ok(self.into()) */ }
   impl<T: Into<Any>> IntoMapResult for Result<T> { /* self.map(Into::into) */ }
   
   A callback can now return any FFI-compatible value directly (i64, String, 
Array<T>, …) or Result<T> to use ?; the conversion to Any happens inside
   
   - Backward compatible: Any: Into<Any> holds reflexively, so existing 
callbacks are unchanged; the two blanket impls are disjoint (Result<T>
   - Tests: new callbacks_return_values_convertible_into_any covers bare i64, 
Result<i64>, and a mutate-context callback; several existing callbacks switched 
to explicit return types (Result<i64>, Result<Array<i64>>) to exercise the new 
path. visit / walk are untouched — their ca flow (WalkResult / VisitInterrupt), 
not values.


-- 
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