Skip to main content

substrait_extensions/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! Packaged Substrait extension files.
4//!
5//! This crate bundles the Substrait specification's extension YAML files, the
6//! text-based JSON schemas, and the function test cases, alongside Rust types
7//! generated from the schemas with [`typify`](https://docs.rs/typify).
8//!
9//! Versions of this crate correspond to Substrait
10//! [releases](https://github.com/substrait-io/substrait/releases).
11//!
12//! - [`text`] — types generated from the text schemas (e.g.
13//!   [`text::simple_extensions::SimpleExtensions`]).
14//! - [`extensions`] — the embedded extension YAML files and an [`extensions::EXTENSIONS`]
15//!   lookup map.
16//! - [`testcases`] — the embedded function test case files.
17
18/// Types generated from the Substrait text-based JSON schemas.
19#[allow(
20    unused_variables,
21    clippy::clone_on_copy,
22    clippy::derivable_impls,
23    clippy::needless_borrow,
24    clippy::explicit_auto_deref,
25    clippy::to_string_trait_impl,
26    clippy::uninlined_format_args
27)]
28pub mod text {
29    include!(concat!(env!("OUT_DIR"), "/substrait_text.rs"));
30}
31
32/// The embedded Substrait core extension YAML files.
33///
34/// The contents of this module are auto-generated by `build.rs` and kept in
35/// sync with the packaged extension files.
36pub mod extensions {
37    include!(concat!(env!("OUT_DIR"), "/extensions.in"));
38}
39
40/// The embedded Substrait function test case files.
41pub mod testcases {
42    use include_dir::{include_dir, Dir};
43
44    /// The directory tree of `.test` function test case files.
45    pub static TESTCASES: Dir<'static> =
46        include_dir!("$CARGO_MANIFEST_DIR/testcases");
47}