1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! # fits-header
//!
//! A pure-Rust, MSVC-safe library for reading and writing the header of a
//! [FITS](https://fits.gsfc.nasa.gov/fits_standard.html) file.
//!
//! It reads a header unit into an ordered [`Header`] of records, retaining every card so untouched
//! cards serialize byte-for-byte and only created or modified cards are re-rendered. Access is
//! strict and keyword-oriented: [`Header::get`] and friends take a [`Key`] that is either a bare
//! name (unique-or-[`FitsError::AmbiguousKeyword`]) or `(name, occurrence)`. Values read through a
//! generic [`FromCard`] and write through [`IntoValue`]; batch edits are atomic; long strings use
//! the `CONTINUE` convention.
//!
//! ```
//! use fits_header::{Header, StructuralHints};
//!
//! let mut h = Header::new();
//! h.set("OBJECT", "M31").unwrap();
//! h.set("EXPTIME", 120.0).unwrap();
//! assert_eq!(h.get::<f64>("EXPTIME").unwrap(), Some(120.0));
//!
//! let bytes = h.to_bytes(&StructuralHints::default()).unwrap();
//! assert_eq!(bytes.len() % fits_header::BLOCK_LEN, 0);
//! ```
//!
//! ## Design
//!
//! - Pure Rust, no C or system libraries; builds with the MSVC toolchain.
//! - An untouched card (and untouched long-string run) re-emits identical bytes.
//! - Ambiguous keyword access errors instead of guessing.
//!
//! ## Features
//!
//! - `serde` *(off)* — derive `Serialize`/`Deserialize` on the public types.
/// Bytes per header card.
pub const CARD_LEN: usize = 80;
/// Bytes per FITS block (36 cards).
pub const BLOCK_LEN: usize = 2880;
pub use crate;
pub use crateFitsError;
pub use crateHeader;
pub use crateKey;
pub use crateparse;
pub use crate;
pub use crate;
pub use crate;
/// Compiles the README's code blocks as doctests so the documented API cannot drift.
;