pdk_classy/
lib.rs

1// Copyright (c) 2025, Salesforce, Inc.,
2// All rights reserved.
3// For full license text, see the LICENSE.txt file
4
5//! Classy - an asynchronous policy development kit
6//!
7//! An abstraction layer over the proxy_wasm framework that transforms the event oriented framework into an async/await model.
8//!
9//! Features
10//!
11//! - `experimental_metrics`: USE AT OWN RISK: experimental items that may change without notice. Exposes the api for host metrics.
12
13mod context;
14mod entrypoint;
15mod handler;
16mod host;
17mod reactor;
18mod types;
19mod utils;
20
21pub mod bootstrap;
22pub mod client;
23pub mod event;
24pub mod extract;
25pub mod grpc;
26pub mod stream;
27pub mod timer;
28pub mod user_agent;
29
30pub mod hl;
31
32#[cfg(feature = "middleware")]
33pub mod middleware;
34
35#[cfg(not(feature = "middleware"))]
36pub mod middleware;
37
38pub mod plugin;
39pub mod shared_data;
40
41pub(crate) mod conversions;
42pub(crate) mod http_constants;
43pub(crate) mod macros;
44
45pub use entrypoint::Entrypoint;
46pub use extract::config::Configuration;
47
48#[cfg(feature = "host")]
49pub use host::{
50    clock::{Clock, DefaultClock, TimeUnit},
51    shared_data::SharedData,
52    DefaultHost, Host,
53};
54
55#[cfg(all(feature = "host", feature = "experimental_metrics"))]
56pub use host::metrics::{MetricType, MetricsHost};
57
58pub use plugin::Plugin;
59
60/// Wrapper for a generic error.
61pub type BoxError = Box<dyn std::error::Error>;
62pub(crate) type BoxFuture<'c, Out> = std::pin::Pin<Box<dyn std::future::Future<Output = Out> + 'c>>;
63
64// Due to a linker error in Windows (https://github.com/rust-lang/rust/issues/86125) that fails when
65// importing a crate that has external symbols, even when they are not being used, we need a
66// proxy-wasm-stub for non wasm32 targets that does not define any extern functions in order to be
67// able to run cargo test (which does not and can not use wasm32 as compilation target)
68#[cfg(target_arch = "wasm32")]
69pub use proxy_wasm;
70#[cfg(not(target_arch = "wasm32"))]
71pub use proxy_wasm_stub as proxy_wasm;