Wire up six unregistered functions#23
Merged
Merged
Conversation
Five complete function implementations existed on disk but were never declared in functions/mod.rs, so they were uncompiled, unexported, and unregistered: upper, to_string, remove_query_args, json_lookup_string, json_lookup_integer. ends_with was exported from the engine but had no FFI dispatch arm. - Declare + export the five modules in functions/mod.rs and engine lib.rs - Register all six in the FFI add_function dispatch (JSON lookups use the Cloudflare names lookup_json_string / lookup_json_integer) - Promote serde_json from dev-dependency to a regular dependency, since the JSON lookup implementations use it at runtime - Drop now-unused test-only imports surfaced by compiling these files
# Conflicts: # engine/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six functions were implemented in the fork but not actually usable. Five had complete implementations (with tests) sitting in
engine/src/functions/that were never declared inmod.rs— so they were never compiled, exported, or registered.ends_withwas exported from the engine but had no FFI dispatch arm.This wires all of them in.
upperupperto_stringto_stringremove_query_argsremove_query_argsjson_lookup_stringlookup_json_stringjson_lookup_integerlookup_json_integerends_withends_withThe JSON lookups register under Cloudflare's canonical names (
lookup_json_string/lookup_json_integer), matching their own test names; the modules were just named in reverse.Changes
functions/mod.rsandengine/src/lib.rs.add_functiondispatch (ffi/src/lib.rs).serde_jsonfrom a dev-dependency to a regular dependency of the engine — the JSON lookup implementations use it at runtime (non-test code), so the crate failed to build outsidecargo testuntil this change.Test plan
RUSTFLAGS=-D warnings cargo build --all-targetscleancargo clippy --all-targets -- -D clippy::allcleancargo +nightly fmt --checkcleancargo test— all pass (engine lib 210 → 238, the +28 being the newly compiled functions' tests)