Skip to main content

zerodds_corba_rust/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3//! Crate `zerodds-corba-rust`. Safety classification: **STANDARD**.
4//!
5//! IDL → Rust code generator for CORBA service constructs (interface
6//! traits + stubs + skeletons, valuetypes, in phase 2: components,
7//! homes, POA bindings).
8//!
9//! Analogous to `zerodds-idl-cpp` / `-csharp` / `-java` but emits Rust
10//! instead of C++/C#/Java. Consumes the `zerodds-corba-codegen` helpers
11//! (special-types tables, stub/skeleton templates) and
12//! `zerodds-idl-rust::type_map` for DataType mapping.
13//!
14//! ## Layer position
15//!
16//! Layer 8 (CORBA stack). Build-time tool, std-only,
17//! `forbid(unsafe_code)`.
18//!
19//! ## Spec source
20//!
21//! `docs/specs/zerodds-corba-rust-1.0.md` (ZeroDDS vendor spec).
22//! Conformance basis: OMG CORBA 3.3 Annex A, OMG IDL4.
23//!
24//! ## What is emitted
25//!
26//! | IDL                           | Rust                                              |
27//! |-------------------------------|---------------------------------------------------|
28//! | `interface I { op(...); };`   | `pub trait I` + `pub struct IStub` + `dispatch_i` |
29//! | `attribute T x`               | trait getter `fn x(&self)` + setter if writable   |
30//! | `oneway op(...)`              | trait method without reply                        |
31//! | `valuetype V { ... };`        | `pub trait V: ValueBase`                          |
32//! | `component C` / `home H`      | (phase 2)                                         |
33//!
34//! ## Public API
35//!
36//! - [`generate_corba_rust_module`] — AST + options → Rust module code.
37//! - [`CorbaRustGenOptions`] — codegen options.
38//! - [`error::CorbaRustError`] — error family.
39//!
40//! Plus the runtime public API that the generated code references:
41//! - [`ObjectReference`] — IOR wrapper.
42//! - [`CorbaException`] — system/user exception variants.
43//! - [`SkeletonResult`] — server dispatch result.
44//! - [`ValueBase`] — trait for all valuetype implementations.
45//! - [`Servant`] — POA servant marker.
46
47#![forbid(unsafe_code)]
48#![warn(missing_docs)]
49
50pub mod ami_emit;
51pub mod component_emit;
52pub mod emitter;
53pub mod error;
54pub mod interface_emit;
55pub mod runtime;
56pub mod value_wire;
57pub mod valuetype_emit;
58
59pub use emitter::{CorbaRustGenOptions, generate_corba_rust_module};
60pub use error::{CorbaRustError, Result};
61pub use runtime::{
62    AsyncCorbaChannel, AsyncReply, AsyncReplyCallback, ComponentHome, ComponentServant,
63    CorbaConnection, CorbaException, IdAssignmentPolicy, IdUniquenessPolicy,
64    ImplicitActivationPolicy, LifespanPolicy, ObjectReference, PoaBuilder, RequestProcessingPolicy,
65    Servant, ServantRetentionPolicy, SkeletonResult, ThreadPolicy, TypeCode, ValueBase,
66    ValueStreamReader, ValueStreamWriter, ValueTagHeader,
67};