nitr_core/lib.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2// This file is part of Nitr.
3// See https://nitrweb.com/ for more information
4// Copyright (C) 2024-present Jose Quintana <joseluisq.net>
5
6//! The resource-controlled Lua runtime at the heart of Nitr: sandboxed
7//! states with memory/execution limits and the fixed runtime pool.
8//!
9//! This crate is deliberately free of HTTP, database, and template
10//! dependencies so it can be embedded on its own; the `nitr` facade crate
11//! is the usual entrypoint for applications.
12
13// Lint policy comes from `[workspace.lints]` in the root Cargo.toml.
14// `unwrap_used`/`expect_used` are denied here (not in the workspace table,
15// which would also hit test and bench targets); unit tests are exempt, and
16// the few documented-invariant `expect()`s carry targeted allows.
17#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
18#![cfg_attr(docsrs, feature(doc_cfg))]
19
20pub mod diag;
21mod error;
22pub mod ns;
23mod runtime;
24
25pub use error::{Error, ErrorInfo, Result, message_token, source_snippet};
26pub use ns::{ModuleFn, mount, nitr_table};
27pub use runtime::{DeadlineHandle, Runtime, RuntimeGuard, RuntimeOpts, RuntimePool, eval_script};