opcda_bridge/lib.rs
1//! Reusable, presentation-free async client for the opcda-bridge gateway's
2//! gRPC API.
3//!
4//! This crate is the typed connect/read/write/browse/list-servers surface
5//! extracted from `opcda-bridge-client`'s `commands.rs`: no `clap`, no
6//! `tabled`, no `serde_json`/`toml` — just [`Client`], the parameters its
7//! methods take, and the plain result types they return ([`BrowseNode`],
8//! [`TagValue`], [`WriteResult`], [`Value`]). `opcda-bridge-client` depends
9//! on this crate and adds only CLI parsing and table/JSON rendering on top
10//! of it; any other async Rust program that needs typed OPC DA
11//! reads/writes/browses without shelling out to the CLI binary and parsing
12//! its output can depend on this crate directly instead.
13//!
14//! ```no_run
15//! # async fn example() -> opcda_bridge::Result<()> {
16//! let mut client = opcda_bridge::Client::connect("localhost:7600").await?;
17//! let servers = client.list_servers().await?;
18//! let values = client
19//! .read(servers[0].clone(), vec!["Some.Tag".into()])
20//! .await?;
21//! # let _ = values;
22//! # Ok(())
23//! # }
24//! ```
25
26mod client;
27mod error;
28mod types;
29
30#[cfg(test)]
31mod test_support;
32
33pub use client::Client;
34pub use error::{Error, Result};
35pub use opcda_bridge_proto::DEFAULT_BRIDGE_PORT;
36pub use types::{BrowseNode, TagValue, Value, WriteResult, parse_value};