summaryrefslogtreecommitdiffstats
path: root/src/buildable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildable.rs')
-rw-r--r--src/buildable.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/buildable.rs b/src/buildable.rs
index 95382e7..37bfc3c 100644
--- a/src/buildable.rs
+++ b/src/buildable.rs
@@ -1,6 +1,6 @@
-use crate::ValueBuilder;
-use crate::CollectionBuilder;
use crate::Backend;
+use crate::CollectionBuilder;
+use crate::ValueBuilder;
// A value that can be built interactively, using a Backend
pub trait BuildableValue: Sized {
@@ -164,7 +164,6 @@ impl BuildableValue for String {
}
-
pub trait BuildableCollection {
fn builder<E, B>(backend: B) -> Box<dyn CollectionBuilder<Output = Self, Error = E>>
where E: Sized,
@@ -183,3 +182,14 @@ impl<T> BuildableCollection for Vec<T>
}
}
+impl<T> BuildableCollection for Option<T>
+ where T: 'static + BuildableValue + Sized
+{
+ fn builder<E, B>(backend: B) -> Box<dyn CollectionBuilder<Output = Option<T>, Error = E>>
+ where E: Sized,
+ B: Backend<Error = E>
+ {
+ backend.option_builder()
+ }
+}
+