Skip to content

feat: Add bundled feature - #65

Open
logan-gatlin wants to merge 1 commit into
Nugine:mainfrom
logan-gatlin:add-bundled-feature
Open

feat: Add bundled feature#65
logan-gatlin wants to merge 1 commit into
Nugine:mainfrom
logan-gatlin:add-bundled-feature

Conversation

@logan-gatlin

@logan-gatlin logan-gatlin commented Aug 20, 2026

Copy link
Copy Markdown

Hello! I'm working on porting node API's to Rust in workerd. I'd like to use these Rust bindings, but they pull in an additional copy of simdutf. This PR adds a bundled feature which when off, allows for linking against an existing simdutf instead.

The bundled feature is on by default. Any users who have default features off will need to explicitly add the bundled feature, so this is a breaking change.

@Nugine
Nugine requested review from Nugine and a balanced review from Copilot and removed request for Copilot August 21, 2026 01:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an optional bundled Cargo feature to the simdutf crate so that consumers (e.g. the workerd Node API port) can link against an externally provided simdutf library instead of compiling the vendored amalgamation, avoiding a duplicate copy of simdutf. When bundled is enabled (the default), the crate compiles the vendored simdutf.cpp; when disabled, it includes only simdutf.h and relies on SIMDUTF_LIB_DIR/SIMDUTF_LIB_NAME to locate/link an existing library. As noted in the description, this is a breaking change for users who disable default features.

Changes:

  • Introduce a bundled feature (default-on) and a links = "simdutf" key in Cargo.toml.
  • Guard the vendored #include "simdutf.cpp" behind SIMDUTFRS_BUNDLED, falling back to #include "simdutf.h" (in both the generated simdutfrs.cpp and its codegen source).
  • Update build.rs to define SIMDUTFRS_BUNDLED for bundled builds and emit link search/lib directives from SIMDUTF_LIB_DIR/SIMDUTF_LIB_NAME otherwise.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Cargo.toml Adds bundled feature (default-on) and links = "simdutf" metadata.
build.rs Conditionally defines SIMDUTFRS_BUNDLED and wires up external lib search/link env vars; contains a build-script feature-detection bug.
cpp/simdutfrs.cpp Wraps the vendored simdutf.cpp include in an SIMDUTFRS_BUNDLED guard with a simdutf.h fallback.
codegen/src/bindings.rs Updates the codegen template to emit the same conditional include block.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread build.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants