Skip to main content

spice/
lib.rs

1#![doc(
2    html_logo_url = "https://raw.githubusercontent.com/GregoireHENRY/rust-spice/main/rust-spice/rsc/img/logo_squared.png",
3    html_favicon_url = "https://raw.githubusercontent.com/GregoireHENRY/rust-spice/main/rust-spice/rsc/img/logo_squared.png"
4)]
5// Doc tests in the README fail with 'lock' enabled
6#![cfg_attr(not(feature = "lock"), doc = include_str!("../README.md"))]
7#![cfg_attr(docsrs, feature(doc_cfg))]
8
9#[cfg(all(feature = "noclang", not(feature = "unlinked")))]
10extern crate cspice_sys_no_clang as cspice_sys;
11
12#[cfg(feature = "unlinked")]
13mod unlinked;
14
15/// The string version of **rust-spice**.
16pub const VERSION: &str = env!("CARGO_PKG_VERSION");
17
18pub mod c {
19    /*!
20    Complete NASA/NAIF C SPICE binded functions, very unsafe.
21    */
22    #[cfg(not(feature = "unlinked"))]
23    pub use cspice_sys::*;
24
25    #[cfg(feature = "unlinked")]
26    pub use crate::unlinked::*;
27}
28
29// The unguarded API should only be exposed if the lock is disabled
30#[cfg(not(feature = "lock"))]
31pub mod core;
32#[cfg(not(feature = "lock"))]
33pub use crate::core::*;
34// If it is enabled, only this crate should see it
35#[cfg(feature = "lock")]
36pub(crate) mod core;
37#[cfg(feature = "lock")]
38pub(crate) use crate::core::*;
39
40// These items need to be exposed regardless of whether 'lock' is enabled or not
41pub use crate::core::cell::{Cell, CellItem, CELL_MAXID, CELL_MAX_LEN};
42pub use crate::core::ffi::{
43    UdBail, UdFunb, UdFunc, UdFuns, UdRefn, UdRepf, UdRepi, UdRepu, UdStep,
44};
45pub use crate::core::raw::{dsk02, ELLIPSE, PLANE};
46// GENERATED: the constants of `raw`, which `lock` would otherwise put out of reach.
47pub use crate::core::raw::{
48    DAF_MAXSUM, DSK02_SPADSZ, DSKXSI_DCSIZE, DSKXSI_ICSIZE, DSK_KEYAMG, DSK_KEYLAL, DSK_KEYPTM,
49    DSK_KEYSGR, DSK_KEYSPM, DSK_KEYXFR, DSK_NSYPAR, EK_CHR, EK_CSTRLN, EK_DP, EK_EXP_COL,
50    EK_EXP_EXPR, EK_EXP_FUNC, EK_INT, EK_MAXQSEL, EK_MXCLSG, EK_TIME, EK_TSTRLN, EK_VARSIZ,
51    SPK_DSCSIZ, TLE_NELTS, TLE_NGEOPHS,
52};
53pub use crate::core::{
54    DLADSC, DSKDSC, EKATTDSC, EKSEGSUM, MAX_LEN_OUT, TIME_FORMAT, TIME_FORMAT_SIZE,
55};
56
57#[cfg(any(feature = "lock", doc))]
58#[cfg_attr(docsrs, doc(cfg(feature = "lock")))]
59pub use crate::core::lock::SpiceLock;