libassist_sys/lib.rs
1//! Raw FFI bindings and safe RAII wrappers for ASSIST.
2//!
3//! ASSIST is a C library for ephemeris-quality integration of test particles
4//! in the solar system, built on top of the REBOUND N-body code. This crate
5//! exposes the underlying C API as:
6//!
7//! - [`ffi`]: raw `extern "C"` bindings to ASSIST functions + types.
8//! - [`Ephemeris`]: thin, allocation-owning RAII wrapper around `assist_ephem`.
9//! - [`AssistSim`]: a REBOUND simulation with ASSIST forces attached.
10//!
11//! This crate depends on `librebound-sys` for the REBOUND FFI types
12//! (`reb_simulation`, `reb_particle`, [`Simulation`], etc.) and re-exports
13//! them at the crate root so downstream consumers can use a single
14//! `libassist-sys` import.
15//!
16//! Higher-level domain logic (orbital-element conversions, observatory
17//! handling, light-time iteration, STM propagation, data downloading) lives
18//! in the companion `assist-rs` crate, which depends on this one.
19
20pub mod ffi;
21mod wrappers;
22
23pub use wrappers::{AssistSim, Ephemeris};
24
25// Re-export REBOUND symbols so downstream consumers can keep a single import.
26pub use librebound_sys::{Ias15AdaptiveMode, IntegratorConfig, Simulation};
27
28/// Errors produced by the ASSIST FFI wrappers.
29///
30/// Wraps [`librebound_sys::Error`] for REBOUND-level failures and adds the
31/// ASSIST-specific ephemeris error variant. Higher-level errors (light-time
32/// convergence, observatory lookup, etc.) live in `assist_rs::Error`, which
33/// wraps this type.
34#[derive(Debug, thiserror::Error)]
35pub enum Error {
36 /// Wrapped REBOUND error from librebound-sys.
37 #[error(transparent)]
38 Reb(#[from] librebound_sys::Error),
39
40 /// ASSIST ephemeris failure (missing file, malformed data, etc.).
41 #[error("ASSIST ephemeris error: {0}")]
42 EphemerisError(String),
43
44 #[error("{0}")]
45 Other(String),
46}
47
48pub type Result<T> = std::result::Result<T, Error>;