How simonrw/rust-fitsio works
Layer Structure (Top to bottom)
• [User Application Layer]
• ↓
• [Rust High-level API (fitsio)]
• ↓
• [Custom Derives (fitsio-derive)]
• ↓
• [FFI Bindings (fitsio-sys)]
• ↓
• [CFITSIO C Library]
• fitsio → fitsio-sys
• fitsio → fitsio-derive
• fitsio-sys → CFITSIO
• Build System → fitsio-sys
• Build System → CFITSIO
Feature Components (Hexagons)
• Thread-safe Operations
• FITS File Operations
• Image Handling
• Table Operations
• Header Management
Integration Points (Diamonds)
• Platform-specific Builds
• NDArray Support
• Memory Management
• Error Handling
Special Considerations:
Platform Support Tiers
• A side panel showing the three-tier platform support system
Build Variants
• Alternative compilation paths:
• Default build
• Bindgen-based build
• Source compilation with fitsio-src feature
Threading Model
• Thread-safe nature of the implementation
• Reentrant support requirements
Error Handling Flow
• Demonstrate error propagation from C to Rust
• Safety boundary between unsafe FFI and safe Rust code
Maintain clear separation between
• Build-time vs. Runtime components
• Safe vs. Unsafe boundaries
• Public vs. Internal APIs
Remember to include version compatibility information and note the relationship with the underlying CFITSIO version requirements (>= 3.37).
This design should help developers understand both the high-level architecture and the detailed interactions between components while maintaining focus on the library's primary purpose as a FITS file manipulation tool.