Skip to content

Unify HostFunctionXX traits into a single HostFunction #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025

Conversation

jprendes
Copy link
Contributor

@jprendes jprendes commented May 7, 2025

This PR removes the HostFunctionXX traits, and replaces them with a single HostFunction trait.

@jprendes jprendes added area/API Related to the API or public interface kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. labels May 7, 2025
@jprendes jprendes force-pushed the host_function branch 2 times, most recently from db41478 to e942802 Compare May 7, 2025 11:09
Copy link

@Copilot Copilot AI left a comment

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 unifies the previously separate HostFunctionXX traits into a single HostFunction trait for host function registration. The key changes include updating imports, function parameters, and macro implementations, resulting in a more streamlined API across tests, examples, and the core host function implementation.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/hyperlight_host/tests/sandbox_host_tests.rs Updated import from HostFunction1 to HostFunction.
src/hyperlight_host/tests/common/mod.rs Replaced HostFunction1 with HostFunction in function parameters.
src/hyperlight_host/src/sandbox/uninitialized.rs Updated host function parameter types from HostFunction1 to HostFunction.
src/hyperlight_host/src/func/mod.rs Removed re-exports for legacy HostFunctionXX traits and exposed HostFunction.
src/hyperlight_host/src/func/host_functions.rs Revised macro implementation to support the unified HostFunction trait.
src/hyperlight_host/src/func/guest_dispatch.rs Updated import from HostFunction0 to HostFunction.
Examples and benches Updated usage of HostFunction trait consistently in place of earlier HostFunctionX versions.

Copy link
Contributor

@danbugs danbugs left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

Great work @jprendes

@jprendes jprendes merged commit 2cd054c into hyperlight-dev:main May 7, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API Related to the API or public interface kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants