Seven-Streams opened a new pull request, #724:
URL: https://github.com/apache/tvm-ffi/pull/724
## Summary
- Seal the structural map/mutate callback-result conversion traits so their
blanket implementations do not define an open downstream extension point.
- Update the Rust language guide to document and demonstrate callbacks that
return `T: Into<Any>` or `Result<T>`.
## Trait sealing
`IntoMapResult` and `IntoMutateResult` now share a private
`callback_result_sealed::Sealed` supertrait. `IntoMapResult` is also hidden
from
the generated API documentation and explicitly documented as a non-extension
point.
The traits remain public because `#[dispatch(map)]` and `#[dispatch(mutate)]`
expansions in downstream crates need to reference their paths. Their
implementations remain owned by `tvm-ffi`.
## Rust guide
The structural mapping and mutation guide now describes callback return
values
as any value convertible into `Any`, either directly or wrapped in `Result`.
The examples cover both forms:
- a `#[dispatch(map)]` handler returning `Result<i64>`;
- callback-based mutation returning `i64` directly;
- a `#[dispatch(mutate)]` handler returning `i64` directly.
The error-handling section now uses `Result<T>` and `Result<i64>`. Existing
`Result<Any>` examples for packed functions and the low-level
`StructuralMutator` interface remain unchanged because those signatures are
fixed.
## Testing
- `cargo fmt --all -- --check`
- `uv run cargo test --workspace`
- `uv run cargo doc -p tvm-ffi --no-deps`
- `uv run --group docs sphinx-build -M html docs docs/_build`
- `git diff --check`
--
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]