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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
use std::error::Error;

#[cfg(feature = "async-walkdir")]
pub use async_walkdir::WalkDir as AsyncWalkDir;
#[cfg(feature = "email_address")]
pub use email_address::EmailAddress;
#[cfg(feature = "globset")]
pub use globset::{Glob, GlobSet, GlobSetBuilder};
#[cfg(feature = "mime")]
pub use mime::Mime;
#[cfg(feature = "num")]
pub use num::BigInt;
#[cfg(feature = "semver")]
pub use semver::Version;
#[cfg(feature = "toml")]
pub use toml::Value as Toml;
#[cfg(feature = "url")]
pub use url::Url;
#[cfg(feature = "walkdir")]
pub use walkdir::WalkDir;

use crate::{IOError, QError, QErrorKind, RuntimeError, SyntaxError};

pub use self::for_ast::NodeLocation;
#[cfg(feature = "rust_decimal")]
pub use self::for_rust_decimal::*;

// #[cfg(feature = "lsp-types")]
// mod for_lsp;
#[cfg(feature = "num")]
mod for_num;
#[cfg(feature = "peginator")]
mod for_peginator;
#[cfg(feature = "ropey")]
mod for_ropey;
#[cfg(feature = "ucd-trie")]
mod for_ucd_trie;

#[cfg(feature = "url")]
mod for_url;

#[cfg(feature = "sled")]
mod for_sled;

#[cfg(feature = "rust_decimal")]
mod for_rust_decimal;
#[cfg(feature = "serde-binary")]
mod for_serde_binary;

#[cfg(feature = "tl")]
mod for_tl;

#[cfg(feature = "globset")]
mod for_globset;

#[cfg(feature = "serde")]
mod for_serde;

#[cfg(feature = "walkdir")]
mod for_walkdir;

#[cfg(feature = "async-walkdir")]
mod for_walkdir_async;

#[cfg(feature = "toml")]
mod for_toml;

#[cfg(feature = "serde_json")]
mod for_serde_json;

#[cfg(feature = "chrono")]
mod for_chrono;
#[cfg(feature = "email_address")]
mod for_email_address;
#[cfg(feature = "mime")]
mod for_mime;
#[cfg(feature = "semver")]
mod for_semver;

#[cfg(feature = "font-kit")]
mod for_font_kit;

#[cfg(feature = "image")]
mod for_image;

#[cfg(feature = "imageproc")]
mod for_imageproc;

mod for_ast;

#[allow(unused)]
impl QError {
    #[inline]
    pub(crate) fn fast_runtime_error(error: impl Error + 'static) -> QError {
        QError {
            error: Box::new(QErrorKind::Runtime(RuntimeError::from(&error))),
            level: Default::default(),
            source: Some(Box::new(error)),
        }
    }
    #[inline]
    pub(crate) fn fast_syntax_error(error: impl Error + 'static) -> QError {
        QError {
            error: Box::new(QErrorKind::Syntax(SyntaxError::from(&error))),
            level: Default::default(),
            source: Some(Box::new(error)),
        }
    }
    #[inline]
    pub(crate) fn fast_io_error(error: impl Error + 'static) -> QError {
        QError {
            error: Box::new(QErrorKind::IO(IOError { message: error.to_string(), file: Default::default() })),
            level: Default::default(),
            source: Some(Box::new(error)),
        }
    }
}