refactor: merge HookLibraries into HookLibrary - #14
Merged
Conversation
Add a `children: Vec<HookLibrary>` field to `HookLibrary` and a `with_hook_library` builder method, enabling arbitrary composition. `set_enabled` now delegates to children with a mirrored enable/disable sequence: enable [self → children], disable [children → self]. The separate `HookLibraries` type is removed; `enable(self, &mut Patcher)` is ported from it. Adds unit tests for nesting behavior and a CI test job.
philpax
added a commit
to ferrobrew/jc3vr
that referenced
this pull request
Jul 4, 2026
re-utilities merged HookLibraries into HookLibrary (ferrobrew/re-utilities#14): a library now nests children via with_hook_library. The top-level aggregator builds one parent library, graphics_engine's leaves each own a standalone library instead of folding extend functions, and input nests locomotion and look rather than reaching across module boundaries for binders. Closes #21.
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
Merges
HookLibrariesintoHookLibraryso thatHookLibrarycan nest childHookLibraryinstances, enabling arbitrary composition. The separateHookLibrariestype is removed.Changes
HookLibrarygainschildren: Vec<HookLibrary>— child libraries are enabled after (and disabled before) the parent's own binders and patches, with a mirrored enable/disable sequence:[self.binders → self.patches → children][children → self.patches → self.binders](exact reverse)with_hook_library(child)builder method for adding child librariesenable(self, &mut Patcher)convenience method ported fromHookLibraries::enableHookLibrariesstruct and impl block removed entirely#[cfg(target_os = "windows")]):test_child_binder_enabled— parent + child binders both enabledtest_child_binder_disabled— all binders return to 0 after disabletest_nested_children— 3-level nesting (parent → child → grandchild)test_enable_returns_self—enable()returnsOk(Self)test_disable_order— verifies disable order is reverse of enable--all-targets(lints test code), and acargo teststep was addedTest plan
cargo clippy --target x86_64-pc-windows-msvc --all-targets -- -Dwarningspasses (0 warnings)grep -rn HookLibrariesreturns zero matchescargo test --target x86_64-pc-windows-msvcpasses in CI (Windows)Closes #13