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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! The active processing state for the standard input.
//!
//! This is where all the 'logic' of standard input processing goes, what
//! actually keeps buffers of input around, and is responsible for updating
//! them, and keeping them in actual sync.
//!
//! ## Rough Overview ##
//!
//! This is a large file that handles the actual logic of reading things
//! out of standard in. Think of this all like the state machine that our
//! [`crate::input::stdin::StdinInputProvider`] can turn into a series of
//! events that a renderer can handle.
//!
//! Our state machine comes in the flavor of three structs (though not all
//! are exported for public use). These are:
//!
//! 1. [`StdinInputState`]: A global wrapper around the underlying input state,
//! provides some methods for querying the current input, but mostly is just
//! a thin 'Read-Write Lock' style interface. Can provide safe concurrent
//! access to the current state.
//! 2. [`self::transaction::ProcessingInputState`]: Effectively a 'write lock' handle to the
//! current input state. The idea is you'd call [`StdinInputState::process`]
//! anytime you get input from a read call or otherwise, and then call
//! methods on processing input state, before finally dropping the write
//! lock (there is certain state that is kept for one set of inputs).
//! 3. [`self::raw::UnlockedStdinInputState`]: The actual 'state'.
//!
//! ## Notes ##
//!
//! As of v0.1.0 most of the methods have some strange-ish return types. These
//! were mostly built to quickly be used by the input provider and it's quickly
//! written internals. Read the documentation for functions on what they
//! return. In the future we hope to actually make the method return types and
//! interacting with these structures easier for non input providers.
use crate;
/// A 'read-write' lock style type around the actual state of what has been
/// received over standard input.
///
/// All methods take a read lock to get info (such as if input has started),
/// except [`StdinInputState::process`] which returns effectively a write
/// lock to the state.