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
mod argument;
mod check;
mod command;
mod convert;
mod framework;

pub use self::{
    argument::{
        ArgumentParam,
        ArgumentParamBuilder,
    },
    check::{
        CheckFn,
        Reason,
    },
    command::{
        Command,
        CommandBuilder,
        HelpCommand,
        HelpCommandBuilder,
        OnProcessFuture,
    },
    convert::{
        ConvertError,
        DataType,
        FromOptionValue,
    },
    framework::{
        Framework,
        FrameworkBuilder,
    },
};
pub use crate::convert::FromOptions;
pub use pikadick_slash_framework_derive::FromOptions;
use std::{
    future::Future,
    pin::Pin,
};

// Compat alias
// TODO: Deprecate
pub type ArgumentKind = DataType;

pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
pub type BoxResult<T> = Result<T, BoxError>;

/// Builder Error
#[derive(Debug, thiserror::Error)]
pub enum BuilderError {
    /// A field is missing
    #[error("missing {0}")]
    MissingField(&'static str),

    /// Something was duplicated
    #[error("duplicate for key '{0}'")]
    Duplicate(Box<str>),
}