proxy_wasm_experimental/
lib.rs

1// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.8")]
16
17pub mod error;
18pub mod hostcalls;
19pub mod traits;
20pub mod types;
21
22mod allocator;
23mod bytestring;
24mod dispatcher;
25mod logger;
26
27pub fn set_log_level(level: types::LogLevel) {
28    logger::set_log_level(level);
29}
30
31pub fn set_root_context<F>(callback: F)
32where
33    F: FnMut(u32) -> Box<dyn traits::RootContext> + 'static,
34{
35    dispatcher::set_root_context(Box::new(callback));
36}
37
38pub fn set_stream_context<F>(callback: F)
39where
40    F: FnMut(u32, u32) -> Box<dyn traits::StreamContext> + 'static,
41{
42    dispatcher::set_stream_context(Box::new(callback));
43}
44
45pub fn set_http_context<F>(callback: F)
46where
47    F: FnMut(u32, u32) -> Box<dyn traits::HttpContext> + 'static,
48{
49    dispatcher::set_http_context(Box::new(callback));
50}
51
52#[no_mangle]
53pub extern "C" fn proxy_abi_version_0_2_0() {}