Add `example_with` attribute
Rexagon opened this issue · 1 comments
Rexagon commented
Sometimes it is useful to generate examples, e.g. for serialized structs or UUID
Rexagon commented
Done.
Usage example:
#[derive(Debug, Default, Serialize, OpgModel)]
#[opg(example_with = "now()")]
struct ExampleWith(u64);
fn now() -> u64 {
use std::time::{SystemTime};
SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs()
}