aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/collection/mock.rs
blob: b37a7096541de24d7eb0e5e769f49571797f9ab8 (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#[cfg(feature = "async")]
use std::pin::Pin;

#[cfg(feature = "dispatch_tree")]
use crate::Dispatcher;

use crate::{AnyOutput, ChainProcess, Groupped, ProgramCollect, RenderResult};

#[cfg(feature = "structural_renderer")]
use crate::{StructuralRendererSetting, error::StructuralRendererSerializeError};

#[cfg(feature = "comp")]
use crate::{ShellContext, Suggest};

#[cfg(feature = "structural_renderer")]
use serde::Serialize;

#[cfg_attr(feature = "structural_renderer", derive(Serialize))]
#[allow(unused)]
pub enum MockProgramCollect {
    Foo,
    Bar,
}

impl Groupped<MockProgramCollect> for MockProgramCollect {
    fn member_id() -> MockProgramCollect {
        MockProgramCollect::Foo
    }
}

impl ProgramCollect for MockProgramCollect {
    type Enum = MockProgramCollect;
    type ErrorDispatcherNotFound = MockProgramCollect;
    type ErrorRendererNotFound = MockProgramCollect;
    type ResultEmpty = MockProgramCollect;

    #[cfg(feature = "dispatch_tree")]
    fn dispatch_args_trie(
        _raw: &[String],
    ) -> Result<AnyOutput<Self::Enum>, crate::error::ProgramInternalExecuteError> {
        unreachable!()
    }

    #[cfg(feature = "dispatch_tree")]
    fn get_nodes() -> Vec<(String, &'static (dyn Dispatcher<Self::Enum> + Send + Sync))> {
        unreachable!()
    }

    fn build_renderer_not_found(_member_id: Self::Enum) -> AnyOutput<Self::Enum> {
        unreachable!()
    }

    fn build_dispatcher_not_found(_args: Vec<String>) -> AnyOutput<Self::Enum> {
        unreachable!()
    }

    fn build_empty_result() -> AnyOutput<Self::Enum> {
        unreachable!()
    }

    fn render(_any: AnyOutput<Self::Enum>, _r: &mut RenderResult) {
        unreachable!()
    }

    fn render_help(_any: AnyOutput<Self::Enum>, _r: &mut RenderResult) {
        unreachable!()
    }

    #[cfg(feature = "async")]
    fn do_chain(
        _any: AnyOutput<Self::Enum>,
    ) -> Pin<Box<dyn Future<Output = ChainProcess<Self::Enum>> + Send>> {
        unreachable!()
    }

    #[cfg(not(feature = "async"))]
    fn do_chain(_any: AnyOutput<Self::Enum>) -> ChainProcess<Self::Enum> {
        unreachable!()
    }

    #[cfg(feature = "comp")]
    fn do_comp(_any: &AnyOutput<Self::Enum>, _ctx: &ShellContext) -> Suggest {
        unreachable!()
    }

    fn has_renderer(_any: &AnyOutput<Self::Enum>) -> bool {
        unreachable!()
    }

    fn has_chain(_any: &AnyOutput<Self::Enum>) -> bool {
        unreachable!()
    }

    #[cfg(feature = "structural_renderer")]
    fn structural_render(
        _any: AnyOutput<Self::Enum>,
        _setting: &StructuralRendererSetting,
    ) -> Result<RenderResult, StructuralRendererSerializeError> {
        unreachable!()
    }
}