rok-core 0.6.1

Core primitives for the rok ecosystem — errors, crypto, i18n, config, DI, and more
Documentation
//! Core error types for the rok ecosystem.
//!
//! Consolidates [`RokError`] (unified application error) and [`Problem`]
//! (RFC 9457 problem details) into a single crate. The original `rok-error`
//! and `rok-problem` crates are kept as deprecated shim re-exports.
//!
//! # Feature flags
//!
//! | Feature | Enables |
//! |---------|---------|
//! | `axum`  | `IntoResponse` for `RokError` and `Problem` |
//!
//! # Example
//!
//! ```rust,ignore
//! use rok_core::{RokError, Problem};
//! use axum::{Json, extract::Path};
//!
//! async fn get_user(Path(id): Path<i64>) -> Result<Json<User>, RokError> {
//!     let user = User::find_or_fail(&pool, id).await?;
//!     Ok(Json(user))
//! }
//! ```

pub mod error;

#[cfg(feature = "debug")]
pub mod debug;

#[cfg(feature = "app")]
pub mod app;

pub mod problem;

pub use error::{RokError, RokException};
pub use problem::Problem;

#[cfg(feature = "named-routes")]
pub mod named_routes;

#[cfg(feature = "named-routes")]
pub mod url;

#[cfg(feature = "i18n")]
pub mod i18n;

#[cfg(feature = "config")]
pub mod config;

pub mod pipeline;

#[cfg(feature = "collection")]
pub mod collection;
#[cfg(feature = "collection")]
pub use collection::RokCollection;

#[cfg(feature = "container")]
pub mod container;

#[cfg(feature = "crypto")]
pub mod crypto;

#[cfg(feature = "api")]
pub mod api;
#[cfg(feature = "api")]
pub use api::{ApiResponse, PaginationMeta};

#[cfg(feature = "api")]
pub mod hooks;