Skip to content

Commit af59924

Browse files
committed
Make sure hosts dont need hyperlight-host dependency
Signed-off-by: Simon Davies <[email protected]>
1 parent 3cee0b9 commit af59924

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

src/hyperlight_wasm/examples/guest-debugging/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ limitations under the License.
4242
//! is built.
4343
4444
use examples_common::get_wasm_module_path;
45-
use hyperlight_host::HyperlightError;
46-
use hyperlight_wasm::{LoadedWasmSandbox, Result, SandboxBuilder};
45+
use hyperlight_wasm::{HyperlightError, LoadedWasmSandbox, Result, SandboxBuilder};
4746

4847
fn get_time_since_boot_microsecond() -> Result<i64> {
4948
let res = std::time::SystemTime::now()

src/hyperlight_wasm/examples/helloworld/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ limitations under the License.
1515
*/
1616

1717
use examples_common::get_wasm_module_path;
18-
use hyperlight_host::HyperlightError;
19-
use hyperlight_wasm::{Result, SandboxBuilder};
18+
use hyperlight_wasm::{HyperlightError, Result, SandboxBuilder};
2019

2120
fn get_time_since_boot_microsecond() -> Result<i64> {
2221
let res = std::time::SystemTime::now()

src/hyperlight_wasm/src/lib.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,38 @@ pub use sandbox::loaded_wasm_sandbox::LoadedWasmSandbox;
2626
pub use sandbox::proto_wasm_sandbox::ProtoWasmSandbox;
2727
pub use sandbox::sandbox_builder::SandboxBuilder;
2828
pub use sandbox::wasm_sandbox::WasmSandbox;
29+
30+
// Re-export types from hyperlight-host so consumers don't need to depend on it directly
31+
2932
/// The container to store the value of a single parameter to a guest
3033
/// function.
3134
pub type ParameterValue = hyperlight_host::func::ParameterValue;
3235
/// The container to store the return value from a guest function call.
3336
pub type ReturnValue = hyperlight_host::func::ReturnValue;
3437
/// The type of the return value from a guest function call.
3538
pub type ReturnType = hyperlight_host::func::ReturnType;
36-
/// The Result of a fuunction call
39+
/// The Result of a function call
3740
pub type Result<T> = hyperlight_host::Result<T>;
41+
42+
/// The error type for Hyperlight operations
43+
pub use hyperlight_host::HyperlightError;
44+
// Re-export function-related types for host function registration
45+
/// A host function that can be registered with a sandbox
46+
pub use hyperlight_host::func::HostFunction;
47+
/// Trait bound for parameter tuples passed to guest/host functions
48+
pub use hyperlight_host::func::ParameterTuple;
49+
/// Trait for types that can register host functions
50+
pub use hyperlight_host::func::Registerable;
51+
/// Trait bound for return types from guest/host functions
52+
pub use hyperlight_host::func::SupportedReturnType;
53+
// Re-export interrupt handle for cancellation support
54+
/// Handle for interrupting guest execution
55+
pub use hyperlight_host::hypervisor::InterruptHandle;
3856
/// Check if there is a hypervisor present
3957
pub use hyperlight_host::is_hypervisor_present;
4058
/// Create a generic HyperlightError
4159
pub use hyperlight_host::new_error;
42-
// A snapshot of the memory of a sandbox at a given point in time.
60+
/// A snapshot of the memory of a sandbox at a given point in time.
4361
pub use hyperlight_host::sandbox::snapshot::Snapshot;
4462

4563
/// Get the build information for this version of hyperlight-wasm

src/hyperlight_wasm/src/sandbox/loaded_wasm_sandbox.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use std::fmt::Debug;
1818
use std::sync::Arc;
1919

2020
use hyperlight_host::func::{ParameterTuple, SupportedReturnType};
21-
// re-export the InterruptHandle trait as it's part of the public API
22-
pub use hyperlight_host::hypervisor::InterruptHandle;
21+
use hyperlight_host::hypervisor::InterruptHandle;
2322
use hyperlight_host::sandbox::Callable;
2423
use hyperlight_host::sandbox::snapshot::Snapshot;
2524
use hyperlight_host::{MultiUseSandbox, Result, log_then_return, new_error};

src/hyperlight_wasm/src/sandbox/sandbox_builder.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl SandboxBuilder {
5151
///
5252
/// # Example:
5353
/// ```rust
54-
/// use hyperlight_host::sandbox::SandboxBuilder;
54+
/// use hyperlight_wasm::SandboxBuilder;
5555
/// let sandbox = SandboxBuilder::new()
5656
/// .with_debugging_enabled(8080) // Enable debugging on port 8080
5757
/// .build()
@@ -134,11 +134,6 @@ impl SandboxBuilder {
134134
self
135135
}
136136

137-
/// Get the current configuration
138-
pub fn get_config(&self) -> &SandboxConfiguration {
139-
&self.config
140-
}
141-
142137
/// Build the ProtoWasmSandbox
143138
pub fn build(self) -> Result<ProtoWasmSandbox> {
144139
if !is_hypervisor_present() {

0 commit comments

Comments
 (0)