Rapier C — 3D / f64 0.36.0+c.0
Loading...
Searching...
No Matches
ABI and errors

Build identity, layout checks, status codes, and thread-local diagnostics. More...

Data Structures

struct  R3ErrorHandler
 An optional thread-local error handler. More...
struct  R3BuildInfo
 Runtime ABI identity and fundamental type sizes. More...
struct  R3BuildFeatures
 Features available through the loaded C library, independent of consumer defines. More...

Macros

#define R3_ABI_VERSION   1
 C binary ABI revision expected by this header.
#define R3_ABI_FEATURE_FEM   1
 ABI feature bit: RAPIER_FEM, which changes the layout of R3IntegrationParameters.
#define R3_ABI_FEATURE_ROBOTICS   2
 ABI feature bit: RAPIER_ROBOTICS (3D, f32 only), which declares the URDF/MJCF API.
#define R3_ABI_FEATURES   1
 R3_ABI_FEATURE_* bits selected by the defines of this header; pass it to CheckAbi.
#define R3_OK   0
 Operation succeeded.
#define R3_NULL_POINTER   1
 A required pointer was NULL.
#define R3_INVALID_ARGUMENT   2
 An argument failed validation.
#define R3_INVALID_HANDLE   3
 The entity handle is stale, invalid, or belongs to another world.
#define R3_BUFFER_TOO_SMALL   4
 Output capacity is insufficient; the returned count is the required capacity.
#define R3_UNSUPPORTED   5
 This build or object does not support the operation.
#define R3_PANIC   6
 Rust panicked; discard objects mutated by the call.
#define R3_NOT_FOUND   7
 No matching query result or object was found.
#define R3_WORLD_BUSY   8
 Conflicting or reentrant access to simulation state.

Typedefs

typedef uint32_t R3Status
 Status-returning operations use these integer codes.
typedef void(*) R3ErrorCallback(R3Status, const char *, void *)
 Called synchronously on the calling thread when an operation reports an error.
typedef struct R3ErrorHandler R3ErrorHandler
 An optional thread-local error handler.
typedef struct R3BuildInfo R3BuildInfo
 Runtime ABI identity and fundamental type sizes.
typedef struct R3BuildFeatures R3BuildFeatures
 Features available through the loaded C library, independent of consumer defines.

Functions

struct R3PodLayout r3PodLayout (void)
 Return POD structure sizes for checking foreign-language layouts against this library.
struct R3ErrorHandler r3SetErrorHandler (struct R3ErrorHandler handler)
 Replace this thread's error handler and return the previous handler so it can be restored at the end of a scope.
R3Status r3LastStatus (void)
 Status of the most recent fallible operation on this thread.
const char * r3LastError (void)
 Thread-local UTF-8 diagnostic, valid until the next fallible call on this thread.
struct R3BuildInfo r3BuildInfo (void)
 Return ABI version, dimension, scalar size, and pointer size of the linked library.
const char * r3Version (void)
 Release version of the loaded C bindings, e.g.
const char * r3BuildProfile (void)
 Cargo profile of the loaded physics library: "debug" or "release".
struct R3BuildFeatures r3BuildFeatures (void)
 Return profiling, SIMD width, parallelism, and determinism of the linked library.
R3Status r3CheckAbi (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.

Detailed Description

Build identity, layout checks, status codes, and thread-local diagnostics.

See Errors and returned values for the return-value convention.

Macro Definition Documentation

◆ R3_ABI_FEATURE_FEM

#define R3_ABI_FEATURE_FEM   1

ABI feature bit: RAPIER_FEM, which changes the layout of R3IntegrationParameters.

◆ R3_ABI_FEATURE_ROBOTICS

#define R3_ABI_FEATURE_ROBOTICS   2

ABI feature bit: RAPIER_ROBOTICS (3D, f32 only), which declares the URDF/MJCF API.

◆ R3_ABI_FEATURES

#define R3_ABI_FEATURES   1

R3_ABI_FEATURE_* bits selected by the defines of this header; pass it to CheckAbi.

◆ R3_ABI_VERSION

#define R3_ABI_VERSION   1

C binary ABI revision expected by this header.

◆ R3_BUFFER_TOO_SMALL

#define R3_BUFFER_TOO_SMALL   4

Output capacity is insufficient; the returned count is the required capacity.

◆ R3_INVALID_ARGUMENT

#define R3_INVALID_ARGUMENT   2

An argument failed validation.

◆ R3_INVALID_HANDLE

#define R3_INVALID_HANDLE   3

The entity handle is stale, invalid, or belongs to another world.

◆ R3_NOT_FOUND

#define R3_NOT_FOUND   7

No matching query result or object was found.

◆ R3_NULL_POINTER

#define R3_NULL_POINTER   1

A required pointer was NULL.

◆ R3_OK

#define R3_OK   0

Operation succeeded.

◆ R3_PANIC

#define R3_PANIC   6

Rust panicked; discard objects mutated by the call.

◆ R3_UNSUPPORTED

#define R3_UNSUPPORTED   5

This build or object does not support the operation.

◆ R3_WORLD_BUSY

#define R3_WORLD_BUSY   8

Conflicting or reentrant access to simulation state.

No mutation was performed.

Typedef Documentation

◆ R3BuildFeatures

typedef struct R3BuildFeatures R3BuildFeatures

Features available through the loaded C library, independent of consumer defines.

◆ R3BuildInfo

typedef struct R3BuildInfo R3BuildInfo

Runtime ABI identity and fundamental type sizes.

◆ R3ErrorCallback

typedef void(*) R3ErrorCallback(R3Status, 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.

◆ R3ErrorHandler

typedef struct R3ErrorHandler R3ErrorHandler

An optional thread-local error handler.

A null callback disables reporting. Keep the callback and user_data alive until the handler is replaced.

◆ R3Status

typedef uint32_t R3Status

Status-returning operations use these integer codes.

Function Documentation

◆ r3BuildFeatures()

struct R3BuildFeatures r3BuildFeatures ( void )

Return profiling, SIMD width, parallelism, and determinism of the linked library.

◆ r3BuildInfo()

struct R3BuildInfo r3BuildInfo ( void )

Return ABI version, dimension, scalar size, and pointer size of the linked library.

◆ r3BuildProfile()

const char * r3BuildProfile ( 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.

◆ r3CheckAbi()

R3Status r3CheckAbi ( 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 R3_ABI_VERSION, R3_DIMENSION, the sizes of R3Real, R3Vector and R3Pose, and R3_ABI_FEATURES. Fails with R3_INVALID_ARGUMENT when the version, dimension, precision, or the RAPIER_FEM/RAPIER_ROBOTICS defines differ from the library, since they change structure layouts.

◆ r3LastError()

const char * r3LastError ( void )

Thread-local UTF-8 diagnostic, valid until the next fallible call on this thread.

◆ r3LastStatus()

R3Status r3LastStatus ( 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.

◆ r3PodLayout()

struct R3PodLayout r3PodLayout ( void )

Return POD structure sizes for checking foreign-language layouts against this library.

◆ r3SetErrorHandler()

struct R3ErrorHandler r3SetErrorHandler ( struct R3ErrorHandler 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 R3_NOT_FOUND query misses.

◆ r3Version()

const char * r3Version ( 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.