summaryrefslogtreecommitdiffstats
path: root/src/backend/mod.rs
blob: 757703c291ddf48e2dcda8891d81badd95174018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pub mod dialoguer;

use crate::BuildableValue;
use crate::BuildableCollection;
use crate::CollectionBuilder;
use crate::ValueBuilder;

/// A backend can be used to get builders for specific types
pub trait Backend: Copy {
    fn bool_builder(&self)   -> Box<dyn ValueBuilder<Output = bool>>;
    fn u8_builder(&self)     -> Box<dyn ValueBuilder<Output = u8>>;
    fn u16_builder(&self)    -> Box<dyn ValueBuilder<Output = u16>>;
    fn u32_builder(&self)    -> Box<dyn ValueBuilder<Output = u32>>;
    fn u64_builder(&self)    -> Box<dyn ValueBuilder<Output = u64>>;
    fn u128_builder(&self)   -> Box<dyn ValueBuilder<Output = u128>>;
    fn i8_builder(&self)     -> Box<dyn ValueBuilder<Output = i8>>;
    fn i16_builder(&self)    -> Box<dyn ValueBuilder<Output = i16>>;
    fn i32_builder(&self)    -> Box<dyn ValueBuilder<Output = i32>>;
    fn i64_builder(&self)    -> Box<dyn ValueBuilder<Output = i64>>;
    fn i128_builder(&self)   -> Box<dyn ValueBuilder<Output = i128>>;
    fn usize_builder(&self)  -> Box<dyn ValueBuilder<Output = usize>>;
    fn isize_builder(&self)  -> Box<dyn ValueBuilder<Output = isize>>;
    fn f32_builder(&self)    -> Box<dyn ValueBuilder<Output = f32>>;
    fn f64_builder(&self)    -> Box<dyn ValueBuilder<Output = f64>>;
    fn char_builder(&self)   -> Box<dyn ValueBuilder<Output = char>>;
    fn string_builder(&self) -> Box<dyn ValueBuilder<Output = String>>;

    fn option_builder<T: 'static + BuildableValue>(&self) -> Box<dyn CollectionBuilder<Output = Option<T>>>;

    fn vec_builder<T>(&self) -> Box<dyn CollectionBuilder<Output = Vec<T>>>
        where T: 'static + BuildableValue;

    fn struct_builder<T>(&self) -> Box<dyn CollectionBuilder<Output = T>>
        where T: 'static + BuildableCollection;
}