cookie-factory in Rust has no documentation on how to understand it. It just lists all the functions. I took a look at examples/http.rs and could understand little about it.
I have the following struct:
pub struct DigestChallengeResponse {
pub username: String,
pub realm: Option<String>,
pub uri: Option<Url>,
pub nonce: Option<String>,
pub cnonce: Option<String>,
pub opaque: Option<String>,
pub stale: Option<bool>,
pub algorithm: Option<Algorithm>,
pub cnonce: i32,
pub qop: Option<Qop>,
pub response: String,
pub userhash: Option<bool>,
}
where the non standard types implement Display
I need to serialize into this:
Authorization: Digest
username="488869477bf257147b804c45308cd62ac4e25eb717
b12b298c79e62dcea254ec",
realm="api@example.org",
uri="/doe.json",
algorithm=SHA-512-256,
nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK",
nc=00000001,
cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v",
qop=auth,
response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d
6c861229025f607a79dd",
opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS",
userhash=true
First of all, do I really need cookie-factory for such simple serialization? And how should I do it?
I took a look at do_gen
, which is one of the main macros, but couldn't understand what it does: cookie_factory::do_gen - Rust