#interactive #serde #console #terminal

serde_spaniel

Spaniel Interactive Deserialiser for Serde

4 releases (breaking)

0.4.0 Aug 2, 2022
0.3.0 May 24, 2021
0.2.0 Jan 20, 2021
0.1.0 Oct 15, 2020

#792 in Encoding

Download history 4/week @ 2024-02-25 38/week @ 2024-03-10 1/week @ 2024-03-17 39/week @ 2024-03-31

78 downloads per month

MIT/Apache

60KB
2K SLoC

Spaniel Interactive Deserialiser for Serde

crates.io docs

This crate is a Rust library which uses the Serde serialisation framework to capture data interactively from users.

Dependency

[dependencies]
serde_spaniel = "0.4"

Using Spaniel

Spaniel can produce a value of any type which implements Serde's Deserialize trait by interactively querying the user for information. For example, to interactively obtain a vector of strings:

let strs: Vec<String> = serde_spaniel::from_console()?;

Hence, a user could input the value vec!["Hello", "World"] using a dialogue such as below:

seq {
  [0] {
    Add element?: y
    string: Hello
  }
  [1] {
    Add element?: y
    string: World
  }
  [2] {
    Add element?: n
  }
}
Accept value?: y

Licence

Dual-licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 licence, shall be dual-licensed as above, without any additional terms or conditions.

Dependencies

~4–14MB
~180K SLoC