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
use Trimmed;
use crateError;
/// A Strand is an object that acts on an input, primarily in a console setting
///
/// # Overview
///
/// A Strand is responsible for taking input from a user and executing some
/// action. In a console application, you will have multiple Strands, each
/// responsible for a different "scope" or "command"
///
/// # Run
///
/// A Strand is given a mutable reference to the current state, a reference to an input string to
/// parse, a reference to a matcher of whitespace characters, and an index of the current scope
///
/// ```rust
/// fn run(
/// state: &mut Self::State,
/// input: Option<Trimmed<str>>,
/// index: usize,
/// ) -> Result<(), Error<Self::Err>>;
/// ```
///
/// # Examples
///
/// ```
/// use parsr::parser_matcher::Matcher;
///
/// use roped::{Strand, Error, EmptyState, Matcher};
///
/// struct StrandExample;
///
/// impl Strand for StrandExample {
/// type State = EmptyState;
/// type Err = ();
///
/// fn run(
/// _state: &mut Self::State,
/// input: Option<Trimmed<str>>,
/// _index: usize,
/// ) -> Result<(), Error<Self::Err>> {
/// for command in input.parse_all(ws) {
/// println!("{},", command.get_arg());
/// }
/// Ok(())
/// }
/// }
/// ```
///
/// # Purpose
///
/// The value of using a Strand is that it intergrates seamlessly with other
/// Strand variants construct using the [`#[derive(Strand)]`](trait@Strand)
/// macro.
///