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
//! [![github]](https://github.com/photino/zino)
//! [![crates-io]](https://crates.io/crates/zino-core)
//! [![docs-rs]](https://docs.rs/zino-core)
//!
//! [github]: https://img.shields.io/badge/github-8da0cb?labelColor=555555&logo=github
//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?labelColor=555555&logo=rust
//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?labelColor=555555&logo=docs.rs
//!
//! Core types and traits for [`zino`].
//!
//! [`zino`]: https://github.com/photino/zino

#![feature(associated_type_defaults)]
#![feature(async_fn_in_trait)]
#![feature(decl_macro)]
#![feature(doc_auto_cfg)]
#![feature(iter_intersperse)]
#![feature(lazy_cell)]
#![feature(let_chains)]
#![feature(result_option_inspect)]
#![forbid(unsafe_code)]

mod crypto;
mod encoding;
mod helper;
mod openapi;

#[cfg(feature = "accessor")]
pub mod accessor;
#[cfg(feature = "cache")]
pub mod cache;
#[cfg(feature = "chatbot")]
pub mod chatbot;
#[cfg(feature = "connector")]
pub mod connector;
#[cfg(feature = "orm")]
pub mod database;
#[cfg(feature = "format")]
pub mod format;
#[cfg(feature = "view")]
pub mod view;

pub mod application;
pub mod auth;
pub mod channel;
pub mod datetime;
pub mod error;
pub mod extension;
pub mod file;
pub mod i18n;
pub mod model;
pub mod request;
pub mod response;
pub mod schedule;
pub mod state;
pub mod trace;

/// A JSON value.
pub type JsonValue = serde_json::Value;

/// A JSON key-value type.
pub type Map = serde_json::Map<String, JsonValue>;

/// An Avro value.
pub type AvroValue = apache_avro::types::Value;

/// A schema-less Avro record value.
pub type Record = Vec<(String, AvroValue)>;

/// A TOML value.
pub type TomlValue = toml::Value;

/// A Universally Unique Identifier (UUID).
pub type Uuid = uuid::Uuid;

/// An allocation-optimized string.
pub type SharedString = std::borrow::Cow<'static, str>;

/// An owned dynamically typed error.
pub type BoxError = Box<dyn std::error::Error + Sync + Send + 'static>;

/// An owned dynamically typed future.
pub type BoxFuture<'a, T = ()> =
    std::pin::Pin<Box<dyn std::future::Future<Output = T> + Send + 'a>>;