Deserializing user input

Is there a crate that allows, for lack of a better term, deserializing from stdin?

Here is an example of what I am thinking of.

#[derive(serde::Deserialize, serde::Serialize)]
pub struct GeneralSettings {
pub cookie: String,
pub proxy: String,
pub static_content: String,
}

-------------------- (Standard output, Standard Input)
Please enter information
GeneralSettings, cookie: some stuff
GeneralSettings, proxy: /asdf/
GeneralSettings, static_content: ./contents


It outputs the name of structs and struct members, prompting the user for a value for each field.

I don't know such a deserializer. I guess you could implement one. The envy deserializer for environment variables seems like something you could adapt to your purposes.

I started on some library code here.
Not the best user experience with Option types yet.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.