Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request significantly enhances the FFI (Foreign Function Interface) API of the
tempoch-fficrate by introducing type-safe duration and difference operations using theQttyQuantitytype from the newqtty-ffidependency. It also improves error safety across the API by wrapping FFI functions with a panic-catching macro, and updates FFI bindings and documentation accordingly.The most important changes are:
Typed Duration and Difference API (QttyQuantity support)
QttyQuantity, providing unit-aware, type-safe results (e.g.,tempoch_jd_difference_qty,tempoch_jd_add_qty,tempoch_mjd_difference_qty,tempoch_mjd_add_qty,tempoch_jd_julian_centuries_qty,tempoch_period_mjd_duration_qty). [1] [2]Cargo.tomlto addqtty-ffias a dependency and bumpqttyto version 0.3.1.FFI Safety and Error Handling
catch_panic!macro to catch Rust panics and return error codes instead of unwinding across the FFI boundary, and applied it to all FFI functions that write to out-pointers or perform conversions. [1] [2] [3] [4] [5] [6] [7]FFI Bindings and Header Updates
cbindgen.tomland the generated C header (tempoch_ffi.h) to includeqtty_ffi.hfor type definitions, exclude duplicate types from auto-generation, and document the new API surface. [1] [2] [3]Documentation Improvements
QttyQuantityin FFI.These changes provide a safer, more expressive, and unit-aware FFI API for time computations, facilitating better integration with C/C++ consumers.