pikadick_slash_framework/
lib.rs

1mod argument;
2mod check;
3mod command;
4mod convert;
5mod framework;
6
7pub use self::{
8    argument::{
9        ArgumentParam,
10        ArgumentParamBuilder,
11    },
12    check::{
13        CheckFn,
14        Reason,
15    },
16    command::{
17        Command,
18        CommandBuilder,
19        HelpCommand,
20        HelpCommandBuilder,
21        OnProcessFuture,
22    },
23    convert::{
24        ConvertError,
25        DataType,
26        FromOptionValue,
27    },
28    framework::{
29        Framework,
30        FrameworkBuilder,
31    },
32};
33pub use crate::convert::FromOptions;
34pub use pikadick_slash_framework_derive::FromOptions;
35use std::{
36    future::Future,
37    pin::Pin,
38};
39
40// Compat alias
41// TODO: Deprecate
42pub type ArgumentKind = DataType;
43
44pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
45pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
46pub type BoxResult<T> = Result<T, BoxError>;
47
48/// Builder Error
49#[derive(Debug, thiserror::Error)]
50pub enum BuilderError {
51    /// A field is missing
52    #[error("missing {0}")]
53    MissingField(&'static str),
54
55    /// Something was duplicated
56    #[error("duplicate for key '{0}'")]
57    Duplicate(Box<str>),
58}