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
//! A declaration that generates the write half alone.
//!
//! `object!` generates the reading impls and the writing ones together, so a
//! field's type has to satisfy both even in a struct the program only ever
//! writes. A declaration that leads with `write_only` generates one direction,
//! the way `json_object!` generates one format.
//!
//! `Register` here stands for whatever a program can put on the wire and could
//! not take off it: a handle into a table the writing process owns, a reading
//! of something that has already moved on. It has no `Read` impl and no
//! `Default`, and the declaration below asks for neither.
//!
//! Kept as a runnable example so the version in docs/schemas.md cannot drift
//! from an API that still compiles. The region between the markers below *is*
//! that version; `docs_quote_the_example_verbatim` in tests/docs.rs fails if
//! the two stop matching.
//!
//! `cargo run --example write_only`
// docs:begin
use ;
/// A handle onto a device register, meaningful on the way out alone.
;
object!;
// docs:end