summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-04-24 13:34:01 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-04-24 13:34:37 +0200
commitddaa455a66bb33299ea67e744f95c92b23715f32 (patch)
tree1e65f4617b0a40e9338de99a7bcc37993c02cbe8
parentd2c13e6f22bb5a116f189c348213e2a45e439df6 (diff)
Add example for Option<bool> and Option<u64>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--examples/option.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/option.rs b/examples/option.rs
new file mode 100644
index 0000000..937733a
--- /dev/null
+++ b/examples/option.rs
@@ -0,0 +1,15 @@
+use interactive_object_builder::*;
+use interactive_object_builder::backend::dialoguer::DialoguerBackend;
+
+fn main() -> Result<(), ()> {
+ let v = Option::<bool>::builder(DialoguerBackend).build_collection("optional yes/no")
+ .map_err(|_| ())?;
+
+ println!("{:?}", v);
+
+ let v = Option::<u64>::builder(DialoguerBackend).build_collection("optional u64")
+ .map_err(|_| ())?;
+
+ println!("{:?}", v);
+ Ok(())
+}