Skip to main content

zerodds_types/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3//! Crate `zerodds-types`. Safety classification: **SAFE**.
4//!
5//! OMG XTypes 1.3 Type-System — TypeIdentifier, TypeObject, Compatibility.
6//! Pure-Rust no_std + alloc, `forbid(unsafe_code)`.
7//!
8//! ## Spec
9//!
10//! - **OMG XTypes 1.3** §7.3.1 (TypeIdentifier), §7.3.4 (TypeIdentifier-Union)
11//! - **OMG XTypes 1.3** §7.3.4 (Minimal + Complete TypeObject)
12//! - **OMG XTypes 1.3** §7.3.5 (TypeInformation + Dependencies)
13//! - **OMG XTypes 1.3** §7.3.6 (TypeLookup Service IDL)
14//! - **OMG XTypes 1.3** §7.2.4 (Assignability + Compatibility-Regeln)
15//! - **OMG XTypes 1.3** §7.6.3 (DynamicType ↔ TypeObject Bridge)
16//! - **OMG XTypes 1.3** §7.6.8 (KeyHash + EquivalenceHash via MD5)
17//! - **OMG DDS 1.4** §2.2.3 (TypeConsistencyEnforcement QoS-Policy)
18//!
19//! ## Schichten-Position
20//!
21//! Layer 1 — Primitives. Direkte Abhängige: `zerodds-discovery`,
22//! `zerodds-dcps`, `zerodds-idl`, `zerodds-rpc`, `zerodds-xml`.
23//! Architektur + RFC: `docs/rfcs/0004-xtypes-integration.md`.
24//!
25//! ## Public-API-Module
26//!
27//! - [`type_identifier`] — TypeIdentifier-Union (§7.3.4.2).
28//! - [`type_object`] — Minimal + Complete TypeObject (§7.3.4).
29//! - [`type_information`] — TypeInformation + Dependencies (§7.3.5).
30//! - [`type_lookup`] — getTypes / getTypeDependencies IDL (§7.3.6).
31//! - [`builder`] — programmatischer Builder für alle Kinds.
32//! - [`hash`] — MD5 → 14-byte EquivalenceHash (§7.3.1.2.1).
33//! - [`resolve`] — TypeRegistry + Alias-Resolution + DoS-Caps.
34//! - [`assignability`] — Type-Compatibility-Regeln (§7.2.4).
35//! - [`type_matcher`] — Writer↔Reader-Matching mit TCE-Policy
36//!   (§7.6.3.7 + §7.2.4).
37//! - [`qos`] — TypeConsistencyEnforcement + DataRepresentation
38//!   (DDS 1.4 §2.2.3).
39//! - [`dynamic`] — DynamicType / DynamicData Reflection-API
40//!   (§7.5) inkl. DynamicType ↔ TypeObject Bridge (§7.6.3).
41//!
42//! ## Wiring-Status
43//!
44//! `assignability` und `type_matcher` sind **Public-API** für End-User-
45//! Code, der eigene Type-Compatibility-Checks außerhalb der DDS-Discovery-
46//! Pipeline durchführt (z.B. Bridge-Implementations, Custom-Schema-
47//! Registries). Die ZeroDDS-Discovery-Pipeline matched aktuell per
48//! `type_name` (DDS 1.4 §2.2.3 Default-Path); volle XTypes-1.3-§7.6
49//! TypeIdentifier-aware Discovery ist eine eigene cross-layer Architektur-
50//! Epic (TypeIdentifier-Konstanten in Codegen + SEDP-Propagation +
51//! TypeRegistry-shared-state).
52
53#![no_std]
54#![forbid(unsafe_code)]
55#![warn(missing_docs)]
56
57// `zerodds-types` setzt `alloc` zwingend voraus — alle Module nutzen
58// `Vec`/`String`/`BTreeMap` fuer TypeObject-Container. `zerodds-cdr` mit
59// `alloc`-Feature ist mandatory dep, also ist `extern crate alloc`
60// immer verfuegbar.
61extern crate alloc;
62
63#[cfg(feature = "std")]
64extern crate std;
65
66pub mod assignability;
67pub mod builder;
68pub mod dynamic;
69pub mod error;
70pub mod hash;
71pub mod qos;
72pub mod resolve;
73pub mod type_identifier;
74pub mod type_information;
75pub mod type_lookup;
76pub mod type_matcher;
77#[cfg(test)]
78mod type_matcher_vectors;
79pub mod type_object;
80
81pub use error::TypeCodecError;
82pub use hash::{
83    compute_complete_hash, compute_hash, compute_minimal_hash, to_hashed_type_identifier,
84};
85pub use type_identifier::{
86    EquivalenceHash, EquivalenceKind, PlainCollectionHeader, PrimitiveKind,
87    StronglyConnectedComponentId, TypeIdentifier,
88};
89pub use type_information::{
90    TypeIdentifierWithDependencies, TypeIdentifierWithSize, TypeInformation,
91};
92pub use type_object::{CompleteTypeObject, MinimalTypeObject, TypeObject};