Skip to main content

clawless_core/prompt/
scripted_answer.rs

1use super::Confirmation;
2
3/// One answer in the script of a [`ScriptedUser`]
4///
5/// Each variant answers one kind of prompt, and it matches no other kind.
6///
7/// [`ScriptedUser`]: super::ScriptedUser
8#[derive(Clone, Eq, PartialEq, Hash, Debug)]
9pub enum ScriptedAnswer {
10    /// The answer to a confirmation
11    Confirm(Confirmation),
12
13    /// The answer to a selection
14    ///
15    /// The value is the position of the chosen option, where the first option has the position
16    /// zero.
17    Select(usize),
18
19    /// The answer to a question for one line of text
20    Text(String),
21}
22
23#[cfg(test)]
24mod tests {
25    use super::*;
26
27    #[test]
28    fn trait_send() {
29        fn assert_send<T: Send>() {}
30        assert_send::<ScriptedAnswer>();
31    }
32
33    #[test]
34    fn trait_sync() {
35        fn assert_sync<T: Sync>() {}
36        assert_sync::<ScriptedAnswer>();
37    }
38
39    #[test]
40    fn trait_unpin() {
41        fn assert_unpin<T: Unpin>() {}
42        assert_unpin::<ScriptedAnswer>();
43    }
44}