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
//! Core types and abstractions for the Toasty ORM.
//!
//! This crate provides the shared foundation used by all Toasty components:
//!
//! - [`Schema`] -- the combined app-level, database-level, and mapping schema
//! - [`stmt`] -- the statement AST used to represent queries and mutations
//! - [`driver`] -- the trait interface that database drivers implement
//! - [`Error`] / [`Result`] -- unified error handling
//!
//! Most users interact with the higher-level `toasty` crate. This crate is
//! relevant when writing database drivers or working with schema internals.
//!
//! # Examples
//!
//! ```ignore
//! use toasty_core::{Schema, Error, Result};
//!
//! fn check_schema(schema: &Schema) -> Result<()> {
//! println!("models: {}", schema.app.models.len());
//! Ok(())
//! }
//! ```
/// Database driver traits and capability descriptions.
pub use Connection;
/// The error type returned by Toasty operations.
pub use Error;
/// Schema definitions spanning the app layer, database layer, and the mapping
/// between them.
pub use Schema;
/// Statement AST types for representing queries, inserts, updates, and deletes.
/// A `Result` type alias that uses Toasty's [`Error`] type.
///
/// This is the standard return type for fallible operations throughout
/// `toasty-core`.
///
/// # Examples
///
/// ```ignore
/// use toasty_core::Result;
///
/// fn validate_name(name: &str) -> Result<()> {
/// if name.is_empty() {
/// return Err(toasty_core::Error::invalid_schema("name must not be empty"));
/// }
/// Ok(())
/// }
/// ```
pub type Result<T, E = Error> = Result;