Skip to main content

spvirit_client/
lib.rs

1//! PVAccess client library — search, connect, get, put, monitor.
2//!
3//! This crate provides both a **high-level API** ([`PvaClient`]) and the
4//! lower-level protocol functions used to build it.
5//!
6//! # High-level API
7//!
8//! ```rust,ignore
9//! use spvirit_client::PvaClient;
10//! use std::ops::ControlFlow;
11//!
12//! let client = PvaClient::builder().build();
13//!
14//! // GET
15//! let result = client.pvget("MY:PV").await?;
16//!
17//! // PUT
18//! client.pvput("MY:PV", 42.0).await?;
19//!
20//! // MONITOR
21//! client.pvmonitor("MY:PV", |val| {
22//!     println!("{val:?}");
23//!     ControlFlow::Continue(())
24//! }).await?;
25//!
26//! // INFO (introspection)
27//! let desc = client.pvinfo("MY:PV").await?;
28//! ```
29//!
30//! # Key types
31//!
32//! - [`PvaClient`] — high-level client with `pvget`, `pvput`, `pvmonitor`, `pvinfo`
33//! - [`PvOptions`] — configuration for PV operations (ports, timeout, auth)
34//! - [`PvGetResult`] — decoded GET result with introspection
35//! - [`ChannelConn`] — low-level established TCP channel
36//! - [`SearchTarget`] — UDP/TCP search target address
37
38pub mod auth;
39pub mod client;
40pub mod format;
41pub mod pva_client;
42pub mod put_encode;
43pub mod pvlist;
44pub mod search;
45pub mod transport;
46pub mod types;
47
48// --- Re-exports: high-level API ---
49pub use pva_client::{PvaClient, PvaClientBuilder, PvaChannel, pvput, pvmonitor, pvinfo, client_from_opts};
50pub use pvlist::PvListSource;
51
52// --- Re-exports: client core ---
53pub use client::{build_client_validation, establish_channel, pvget, ChannelConn};
54pub use search::{build_auto_broadcast_targets, search_pv, resolve_pv_server, SearchTarget};
55pub use transport::read_packet;
56pub use types::{PvGetError, PvGetOptions, PvGetResult, PvMonitorEvent, PvOptions};
57pub use format::{format_output, OutputFormat, RenderOptions};