rent
ReferenceCommand line

rent extension init

Use rent extension init when an application needs a PostgreSQL extension that Rent does not ship as a first-party pack. The generated crate contains a manifest, typed pack definition, and validation test.

Scaffold a pack

rent extension init pg_routing

Successful scaffolding names the new package and the next step:

Created ./crates/rent-ext-pg-routing
Next: Implement the typed extension API, then run its nextest suite.

It creates the pack and registers its manifest with the project:

crates/rent-ext-pg-routing/Cargo.toml
crates/rent-ext-pg-routing/rent-extension.json
crates/rent-ext-pg-routing/src/lib.rs

The manifest path is appended to extension_manifests in rent.toml so rent extension check and migration preflight can read it.

The generated library starts with a valid extension definition:

pub struct PgRouting;

impl ExtensionPack for PgRouting {
    fn manifest() -> ExtensionManifest {
        ExtensionManifest::new("pg_routing", ">=1")
    }
}

Add typed functions, operators, index definitions, installation requirements, and high-level clients before publishing the pack.

Choose an output directory

rent extension init pg_routing --target extensions/routing
extensions/routing/Cargo.toml
extensions/routing/rent-extension.json
extensions/routing/src/lib.rs

Use a custom target when extension packs live outside the application workspace.

Validate the generated pack

cargo nextest run --manifest-path crates/rent-ext-pg-routing/Cargo.toml
PASS [   0.008s] (1/1) rent-ext-pg-routing tests::extension_pack_conforms
Summary [   0.008s] 1 test run: 1 passed, 0 skipped

The validation contract catches invalid names, version requirements, dependencies, and migration contributions before the pack reaches an application.

On this page