Rexagon/opg

Add `example_with` attribute

Rexagon opened this issue · 1 comments

Sometimes it is useful to generate examples, e.g. for serialized structs or UUID

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()
}