Skip to main content

Module scaffold

Module scaffold 

Source
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-sys deps)
  • Makefile (delegates to cargo build + metadata scripts from extension-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§

GeneratedFile
A generated file with its relative path and content.
Scaffold
What generate_scaffold_with_warnings produces: the files to write, and what about the configuration deserves a second look although it was accepted.
ScaffoldConfig
Configuration for generating a new extension project.

Constants§

DEFAULT_EXCLUDED_PLATFORMS
The default ScaffoldConfig::excluded_platforms: the three DuckDB-Wasm targets and windows_amd64_mingw.
DISTRIBUTION_CI_TOOLS_REF
The extension-ci-tools branch a stable-ABI (C_STRUCT) scaffold builds with, for DISTRIBUTION_DUCKDB_VERSION.
DISTRIBUTION_DUCKDB_VERSION
The DuckDB release a stable-ABI (C_STRUCT) scaffold’s distribution workflow builds and tests against: its duckdb_version.
REF_PLACEHOLDER
Placeholder written as repo.ref when ScaffoldConfig::git_ref is left at its default.

Functions§

generate_scaffold
Generates the complete set of project files for a new DuckDB Rust extension.
generate_scaffold_with_warnings
Generates the project files, and the warnings about the configuration.