Skip to main content

xtce_model/
lib.rs

1//! XTCE telemetry metadata: a streaming XML reader and an arena-backed intermediate
2//! representation.
3//!
4//! This crate turns an XTCE `SpaceSystem` document into [`XtceDb`], a flat, index-addressed
5//! model that [`xtce-decode`](https://docs.rs/xtce-decode) walks to decode CCSDS packets and
6//! that `xtce-codegen` compiles into static Rust decoders.
7//!
8//! # Scope
9//!
10//! Only `TelemetryMetaData` is modelled; see `SUPPORTED.md` in the repository for the exact
11//! coverage table. Constructs outside the *decodable* subset are still **represented** —
12//! they surface as explicit IR variants and via [`XtceDb::unsupported`] — so that loading a
13//! real mission database never fails merely because part of it is out of scope. The error
14//! is raised by the decoder, at the point a value actually depends on the construct.
15//!
16//! # Example
17//!
18//! ```no_run
19//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
20//! let db = xtce_model::XtceDb::from_path("testdata/spp/jpss/jpss1_geolocation_xtce_v1.xml")?;
21//! println!("{} parameters, {} containers", db.parameters().len(), db.containers().len());
22//! # Ok(())
23//! # }
24//! ```
25
26#![deny(missing_docs)]
27#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
28#![deny(clippy::todo, clippy::unimplemented)]
29#![warn(clippy::pedantic)]
30#![allow(clippy::module_name_repetitions)]
31// Hash values are deliberately narrowed to a bucket index; the mask that makes the
32// narrowing exact is on the same line.
33#![allow(clippy::cast_possible_truncation)]
34// Tests are allowed to assert loudly; the no-panic rule is about library code reached by a
35// live downlink, not about test setup.
36#![cfg_attr(
37    test,
38    allow(
39        clippy::unwrap_used,
40        clippy::expect_used,
41        clippy::panic,
42        clippy::float_cmp
43    )
44)]
45
46pub mod commands;
47pub mod containers;
48pub mod db;
49pub mod error;
50pub mod ids;
51pub mod intern;
52mod lower;
53pub mod types;
54pub mod xml;
55
56pub use commands::MetaCommand;
57pub use containers::{
58    BooleanExpr, CompareOp, Comparison, ComparisonValue, Condition, Container, Entry, EntryKind,
59    Location, LocationReference, MatchCriteria, Operand, SpaceSystem,
60};
61pub use db::{Stats, Unsupported, XtceDb};
62pub use error::{RefKind, XtceError};
63pub use ids::{ContainerId, MetaCommandId, ParamId, SpaceSystemId, Span, TypeId};
64pub use intern::{Interner, NameId};
65pub use types::{
66    AggregateMember, ArrayDimension, BinaryEncoding, ByteOrder, Calibrator, Charset,
67    ContextCalibrator, DataEncoding, DiscreteLookup, Enumeration, EnumerationList, FloatCoding,
68    FloatEncoding, IntegerCoding, IntegerEncoding, LinearAdjustment, Parameter, ParameterType,
69    PolynomialTerm, SizeSpec, Spline, SplinePoint, StringDelimiter, StringEncoding, TypeKind,
70};