|
Rapier C — 2D / f32 0.36.0+c.0
|
Build identity, layout checks, status codes, and thread-local diagnostics. More...
Data Structures | |
| struct | R2ErrorHandler |
| An optional thread-local error handler. More... | |
| struct | R2BuildInfo |
| Runtime ABI identity and fundamental type sizes. More... | |
| struct | R2BuildFeatures |
| Features available through the loaded C library, independent of consumer defines. More... | |
Macros | |
| #define | R2_ABI_VERSION 1 |
| C binary ABI revision expected by this header. | |
| #define | R2_ABI_FEATURE_FEM 1 |
| ABI feature bit: RAPIER_FEM, which changes the layout of R2IntegrationParameters. | |
| #define | R2_ABI_FEATURE_ROBOTICS 2 |
| ABI feature bit: RAPIER_ROBOTICS (3D, f32 only), which declares the URDF/MJCF API. | |
| #define | R2_ABI_FEATURES 1 |
| R2_ABI_FEATURE_* bits selected by the defines of this header; pass it to CheckAbi. | |
| #define | R2_OK 0 |
| Operation succeeded. | |
| #define | R2_NULL_POINTER 1 |
| A required pointer was NULL. | |
| #define | R2_INVALID_ARGUMENT 2 |
| An argument failed validation. | |
| #define | R2_INVALID_HANDLE 3 |
| The entity handle is stale, invalid, or belongs to another world. | |
| #define | R2_BUFFER_TOO_SMALL 4 |
| Output capacity is insufficient; the returned count is the required capacity. | |
| #define | R2_UNSUPPORTED 5 |
| This build or object does not support the operation. | |
| #define | R2_PANIC 6 |
| Rust panicked; discard objects mutated by the call. | |
| #define | R2_NOT_FOUND 7 |
| No matching query result or object was found. | |
| #define | R2_WORLD_BUSY 8 |
| Conflicting or reentrant access to simulation state. | |
Typedefs | |
| typedef uint32_t | R2Status |
| Status-returning operations use these integer codes. | |
| typedef void(*) | R2ErrorCallback(R2Status, const char *, void *) |
| Called synchronously on the calling thread when an operation reports an error. | |
| typedef struct R2ErrorHandler | R2ErrorHandler |
| An optional thread-local error handler. | |
| typedef struct R2BuildInfo | R2BuildInfo |
| Runtime ABI identity and fundamental type sizes. | |
| typedef struct R2BuildFeatures | R2BuildFeatures |
| Features available through the loaded C library, independent of consumer defines. | |
Functions | |
| struct R2PodLayout | r2PodLayout (void) |
| Return POD structure sizes for checking foreign-language layouts against this library. | |
| struct R2ErrorHandler | r2SetErrorHandler (struct R2ErrorHandler handler) |
| Replace this thread's error handler and return the previous handler so it can be restored at the end of a scope. | |
| R2Status | r2LastStatus (void) |
| Status of the most recent fallible operation on this thread. | |
| const char * | r2LastError (void) |
| Thread-local UTF-8 diagnostic, valid until the next fallible call on this thread. | |
| struct R2BuildInfo | r2BuildInfo (void) |
| Return ABI version, dimension, scalar size, and pointer size of the linked library. | |
| const char * | r2Version (void) |
| Release version of the loaded C bindings, e.g. | |
| const char * | r2BuildProfile (void) |
| Cargo profile of the loaded physics library: "debug" or "release". | |
| struct R2BuildFeatures | r2BuildFeatures (void) |
| Return profiling, SIMD width, parallelism, and determinism of the linked library. | |
| R2Status | r2CheckAbi (uint32_t version, uint32_t dimension, size_t real_size, size_t vector_size, size_t pose_size, uint32_t features) |
| Check that the header matches the linked library before passing any structure across the ABI. | |
Build identity, layout checks, status codes, and thread-local diagnostics.
See Errors and returned values for the return-value convention.
| #define R2_ABI_FEATURE_FEM 1 |
ABI feature bit: RAPIER_FEM, which changes the layout of R2IntegrationParameters.
| #define R2_ABI_FEATURE_ROBOTICS 2 |
ABI feature bit: RAPIER_ROBOTICS (3D, f32 only), which declares the URDF/MJCF API.
| #define R2_ABI_FEATURES 1 |
R2_ABI_FEATURE_* bits selected by the defines of this header; pass it to CheckAbi.
| #define R2_ABI_VERSION 1 |
C binary ABI revision expected by this header.
| #define R2_BUFFER_TOO_SMALL 4 |
Output capacity is insufficient; the returned count is the required capacity.
| #define R2_INVALID_ARGUMENT 2 |
An argument failed validation.
| #define R2_INVALID_HANDLE 3 |
The entity handle is stale, invalid, or belongs to another world.
| #define R2_NOT_FOUND 7 |
No matching query result or object was found.
| #define R2_NULL_POINTER 1 |
A required pointer was NULL.
| #define R2_OK 0 |
Operation succeeded.
| #define R2_PANIC 6 |
Rust panicked; discard objects mutated by the call.
| #define R2_UNSUPPORTED 5 |
This build or object does not support the operation.
| #define R2_WORLD_BUSY 8 |
Conflicting or reentrant access to simulation state.
No mutation was performed.
| typedef struct R2BuildFeatures R2BuildFeatures |
Features available through the loaded C library, independent of consumer defines.
| typedef struct R2BuildInfo R2BuildInfo |
Runtime ABI identity and fundamental type sizes.
| typedef void(*) R2ErrorCallback(R2Status, const char *, void *) |
Called synchronously on the calling thread when an operation reports an error.
The diagnostic is borrowed for the duration of the callback. The callback must return normally or terminate the process: never throw or longjmp across the Rust/C boundary. Nested failing calls do not invoke the handler recursively.
| typedef struct R2ErrorHandler R2ErrorHandler |
An optional thread-local error handler.
A null callback disables reporting. Keep the callback and user_data alive until the handler is replaced.
| typedef uint32_t R2Status |
Status-returning operations use these integer codes.
| struct R2BuildFeatures r2BuildFeatures | ( | void | ) |
Return profiling, SIMD width, parallelism, and determinism of the linked library.
| struct R2BuildInfo r2BuildInfo | ( | void | ) |
Return ABI version, dimension, scalar size, and pointer size of the linked library.
| const char * r2BuildProfile | ( | void | ) |
Cargo profile of the loaded physics library: "debug" or "release".
Custom profiles report the corresponding inherited Cargo profile category. The UTF-8, NUL-terminated string is borrowed for the library's lifetime; do not free it. This is independent of the consumer's build mode and of per-package optimization overrides.
| R2Status r2CheckAbi | ( | uint32_t | version, |
| uint32_t | dimension, | ||
| size_t | real_size, | ||
| size_t | vector_size, | ||
| size_t | pose_size, | ||
| uint32_t | features ) |
Check that the header matches the linked library before passing any structure across the ABI.
Pass R2_ABI_VERSION, R2_DIMENSION, the sizes of R2Real, R2Vector and R2Pose, and R2_ABI_FEATURES. Fails with R2_INVALID_ARGUMENT when the version, dimension, precision, or the RAPIER_FEM/RAPIER_ROBOTICS defines differ from the library, since they change structure layouts.
| const char * r2LastError | ( | void | ) |
Thread-local UTF-8 diagnostic, valid until the next fallible call on this thread.
| R2Status r2LastStatus | ( | void | ) |
Status of the most recent fallible operation on this thread.
Reading this or LastError does not clear it. Infallible value constructors do not change it. Check immediately after a fallible value-returning operation when recovering from errors instead of using a fail-fast error callback.
| struct R2PodLayout r2PodLayout | ( | void | ) |
Return POD structure sizes for checking foreign-language layouts against this library.
| struct R2ErrorHandler r2SetErrorHandler | ( | struct R2ErrorHandler | handler | ) |
Replace this thread's error handler and return the previous handler so it can be restored at the end of a scope.
Status returns are unchanged. A handler that returns lets the caller recover by checking the status; a fail-fast handler may terminate the process. Includes R2_NOT_FOUND query misses.
| const char * r2Version | ( | void | ) |
Release version of the loaded C bindings, e.g.
"0.35.3+c.2". The suffix identifies the C bindings revision for the Rust crate version. The UTF-8, NUL-terminated string is borrowed for the library's lifetime; do not free it. This release identifier is independent of the ABI compatibility version.