hyperlight_host/func/mod.rs
1/*
2Copyright 2024 The Hyperlight Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17/// Context structures used to allow the user to call one or more guest
18/// functions on the same Hyperlight sandbox instance, all from within the
19/// same state and mutual exclusion context.
20pub mod call_ctx;
21/// Functionality to dispatch a call from the host to the guest
22pub(crate) mod guest_dispatch;
23/// Functionality to check for errors after a guest call
24pub(crate) mod guest_err;
25/// Definitions and functionality to enable guest-to-host function calling,
26/// also called "host functions"
27///
28/// This module includes functionality to do the following
29///
30/// - Define several prototypes for what a host function must look like,
31/// including the number of arguments (arity) they can have, supported argument
32/// types, and supported return types
33/// - Registering host functions to be callable by the guest
34/// - Dynamically dispatching a call from the guest to the appropriate
35/// host function
36pub(crate) mod host_functions;
37/// Definitions and functionality for supported parameter types
38pub(crate) mod param_type;
39/// Definitions and functionality for supported return types
40pub(crate) mod ret_type;
41
42/// Re-export for `HostFunction` trait
43pub use host_functions::HostFunction;
44/// Re-export for `ParameterValue` enum
45pub use hyperlight_common::flatbuffer_wrappers::function_types::ParameterValue;
46/// Re-export for `ReturnType` enum
47pub use hyperlight_common::flatbuffer_wrappers::function_types::ReturnType;
48/// Re-export for `ReturnType` enum
49pub use hyperlight_common::flatbuffer_wrappers::function_types::ReturnValue;
50pub use param_type::{ParameterTuple, SupportedParameterType};
51pub use ret_type::{ResultType, SupportedReturnType};
52
53mod utils;