Expand description
Project scaffolding for DuckDB Rust extensions.
Generates the complete file set needed to build and submit a DuckDB extension
to the community extensions repository — without any C++ glue.
§Background
The DuckDB C Extension API (used by the official
extension-template-rs)
allows pure-Rust extensions that need only:
Cargo.toml(cdylib,quack-rs+libduckdb-sysdeps)Makefile(delegates tocargo build+ metadata scripts fromextension-ci-tools)src/lib.rs(entry point + function registration)extension-ci-tools/(git submodule for CI/CD)description.yml(extension metadata for community submission)
This module generates all of these from a ScaffoldConfig, plus a
SQLLogicTest, two GitHub Actions workflows (fast native checks, and the
extension-ci-tools distribution build for every community platform), a
README.md, the license text, a cargo-deny configuration, the
docs/function_descriptions.csv the community documentation site reads,
and the supporting dotfiles. The quack_scaffold binary
(cargo install quack-rs --bin quack_scaffold) writes them to disk.
§Example
use quack_rs::scaffold::{ScaffoldConfig, generate_scaffold_with_warnings};
let config = ScaffoldConfig {
name: "my_analytics".to_string(),
description: "Fast analytics functions for DuckDB".to_string(),
version: "0.1.0".to_string(),
license: "MIT".to_string(),
maintainer: "Jane Doe".to_string(),
github_repo: "janedoe/duckdb-my-analytics".to_string(),
// `excluded_platforms` defaults to DEFAULT_EXCLUDED_PLATFORMS.
..ScaffoldConfig::default()
};
let scaffold = generate_scaffold_with_warnings(&config).unwrap();
let files = &scaffold.files;
assert!(files.iter().any(|f| f.path == "Cargo.toml"));
assert!(files.iter().any(|f| f.path == "Makefile"));
assert!(files.iter().any(|f| f.path == "src/lib.rs"));
assert!(files.iter().any(|f| f.path == "description.yml"));
assert!(scaffold.warnings.is_empty());Structs§
- Generated
File - A generated file with its relative path and content.
- Scaffold
- What
generate_scaffold_with_warningsproduces: the files to write, and what about the configuration deserves a second look although it was accepted. - Scaffold
Config - Configuration for generating a new extension project.
Constants§
- DEFAULT_
EXCLUDED_ PLATFORMS - The default
ScaffoldConfig::excluded_platforms: the threeDuckDB-Wasm targets andwindows_amd64_mingw. - DISTRIBUTION_
CI_ TOOLS_ REF - The
extension-ci-toolsbranch a stable-ABI (C_STRUCT) scaffold builds with, forDISTRIBUTION_DUCKDB_VERSION. - DISTRIBUTION_
DUCKDB_ VERSION - The
DuckDBrelease a stable-ABI (C_STRUCT) scaffold’s distribution workflow builds and tests against: itsduckdb_version. - REF_
PLACEHOLDER - Placeholder written as
repo.refwhenScaffoldConfig::git_refis left at its default.
Functions§
- generate_
scaffold - Generates the complete set of project files for a new
DuckDBRust extension. - generate_
scaffold_ with_ warnings - Generates the project files, and the warnings about the configuration.