rs_teststand_bridge/lib.rs
1//! Serving the TestStand™ Engine to other processes.
2//!
3//! The engine is a single-threaded-apartment COM object: the wrappers in
4//! [`rs_teststand`] are deliberately neither [`Send`] nor [`Sync`], so one
5//! thread owns the engine and no other may touch it. A user interface is the
6//! opposite, its own thread, its own event loop, often its own process, and
7//! often not even the same language.
8//!
9//! This crate is the seam between the two. Nothing that crosses it is a COM
10//! reference; what crosses is data:
11//!
12//! - [`MessageEvent`], one engine message flattened into something sendable,
13//! including the object payload, serialized through `rs-teststand-serde`.
14//! - [`Command`], what a user interface asks the host to do.
15//! - [`Response`], the host's answer to one command.
16//!
17//! Those three types are shared by every transport, so a front end written
18//! against one can move to another without its message handling changing:
19//!
20//! - `rs-teststand-websocket`, bidirectional, framed by the protocol, and what
21//! a browser or a modern panel should use. **Start here.**
22//! - [`transport::line`], one JSON object per line over raw TCP, CRLF-framed,
23//! for a script or an older tool that speaks nothing else.
24//!
25//! [`EngineHost`] is a different answer to a different question: it gives the
26//! engine a thread and lets many callers submit closures to it. Use it when the
27//! work is in-process; use a transport when the other side is not.
28//!
29//! This is an **addition to** the binding, not part of it: [`rs_teststand`]
30//! carries no async runtime and no transport, and a caller driving the engine
31//! in-process never pays for one.
32
33#![forbid(unsafe_code)]
34
35pub mod ack;
36mod command;
37pub mod error;
38pub mod event;
39pub mod host;
40pub mod response;
41pub mod transport;
42pub mod watch;
43
44pub use ack::{Ack, AckState, CODE_FAILED, CODE_OK};
45pub use command::{Command, ExecutionControl};
46pub use error::Error;
47pub use event::{MessageEvent, PayloadPolicy};
48pub use host::EngineHost;
49pub use response::Response;
50pub use transport::line::{LineSink, LineSource};
51pub use watch::{ClientTimeout, ClientWatch, WatchState};