toasty 0.6.1

An async ORM for Rust supporting SQL and NoSQL databases
Documentation
//! Internal types referenced by code generated by `#[derive(Model)]` and the
//! `create!` / `query!` macros. Not part of the public API; the contents may
//! change between releases.

#![doc(hidden)]

pub mod auto;
pub mod newtype;
pub mod storage;

pub use crate::schema::inventory;
pub use crate::{
    Db, Error, Executor, Result, Statement,
    schema::create_meta::{assert_create_fields, const_contains},
    schema::{
        Auto, BelongsTo, CreateField, CreateMeta, Defer, Deferred, DiscoverItem, Embed, Field,
        HasMany, HasOne, Load, Model, Register, Relation, Scope, ValidateCreate,
        build_deferred_load, generate_unique_id,
    },
    stmt::CreateMany,
    stmt::{self, Assign, IntoExpr, IntoInsert, IntoStatement, List, Path},
    update_target::UpdateTarget,
};
#[cfg(feature = "serde")]
pub use serde_json;
pub use std::{convert::Into, default::Default, option::Option};

pub use toasty_core as core;

/// Infer the [`Scope`] type from a scope expression and return its fields
/// path.
///
/// The `create!` macro uses this in the scoped form (`in expr { ... }`) to
/// obtain the field struct for nested builders. Because the macro has no
/// type information, it cannot call `S::new_path_root()` directly — this function
/// lets Rust infer `S` from the scope argument.
pub fn scope_fields<S: Scope>(_scope: &S) -> S::Path<S::Item> {
    S::new_path_root()
}

/// Convert a value into an untyped [`core::stmt::Expr`] via the typed
/// [`IntoExpr<T>`] trait.
///
/// Generated code (`#[derive(Model)]`, `#[derive(Embed)]`) splices this in
/// instead of inlining the `let expr: Expr<T> = value.into_expr(); expr.into()`
/// pattern at every field site. The explicit `T` type parameter
/// disambiguates which `IntoExpr` impl to use.
pub fn into_untyped_expr<T, V: IntoExpr<T>>(value: V) -> core::stmt::Expr {
    let expr: stmt::Expr<T> = value.into_expr();
    expr.into()
}