1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Example: a fully described scalar PV.
//!
//! Engineering units, precision, description, alarm limits, drive limits
//! and a monitor deadband — all of it set through typed `Pv<T>` handles,
//! which is the only way to set them in code. The `PvaServer::builder()`
//! record methods take a name and an initial value and nothing else.
//!
//! Also demonstrates picking the NTScalar wire type explicitly via
//! `Pv::<ScalarValue>::scalar_in`/`scalar_out`, for the eight types
//! (`byte`/`short`/`ubyte`/`ushort`/`uint`/`ulong`, plus explicit
//! `float`/`bool`/`long`/`string`) the fixed-type constructors
//! (`Pv::ai`/`ao`/`bi`/`bo`/`longin`/`longout`/`string_in`/`string_out`)
//! don't reach.
//!
//! Try it:
//! cargo run -p spvirit-server --example scalar_metadata
//!
//! Then from another terminal:
//! spget SIM:TEMPERATURE # value, units and precision
//! spget SIM:TEMPERATURE.MDEL # 0.5 — MDEL lands in the record's fields
//! spput SIM:SETPOINT 30 # accepted
//! spput SIM:SETPOINT 500 # ALSO accepted — drive limits are
//! # advertised to clients, not enforced by
//! # the server. Reject out-of-range writes
//! # yourself with `.on_put(...)`.
//! spinfo SIM:GAIN # wire type: ushort
//! spinfo SIM:STATUS # wire type: byte
use ;
use ScalarValue;
async