pub use wit_bindgen;
#[macro_export]
macro_rules! frost_component {
(
component: $component:tt,
world: $world:literal,
path: $wit_path:literal $(,)?
) => {
pub mod bindings {
use super::*;
use $crate::wit_bindgen as wit_bindgen;
$crate::wit_bindgen::generate!({
world: $world,
path: $wit_path,
generate_all,
runtime_path: "frost_guest_sdk::wit_bindgen::rt",
});
export!($component);
}
pub mod sdk_guest {
pub use super::bindings;
pub mod outcome {
use super::bindings::exports::frost::batch::job::{
FailureOutcome, MessageOutcome, Outcome, RetryOutcome,
};
pub fn ok(message: impl Into<String>) -> Outcome {
Outcome::Success(MessageOutcome {
message: message.into(),
props: Vec::new(),
})
}
pub fn ok_with_props(
message: impl Into<String>,
props: Vec<super::bindings::frost::core::types::Kv>,
) -> Outcome {
Outcome::Success(MessageOutcome {
message: message.into(),
props,
})
}
pub fn retry(message: impl Into<String>, retry_after_ns: Option<u64>) -> Outcome {
Outcome::Retry(RetryOutcome {
message: message.into(),
retry_after_ns,
props: Vec::new(),
})
}
pub fn retry_with_props(
message: impl Into<String>,
retry_after_ns: Option<u64>,
props: Vec<super::bindings::frost::core::types::Kv>,
) -> Outcome {
Outcome::Retry(RetryOutcome {
message: message.into(),
retry_after_ns,
props,
})
}
pub fn fail(message: impl Into<String>, permanent: bool) -> Outcome {
Outcome::Failure(FailureOutcome {
message: message.into(),
permanent,
props: Vec::new(),
})
}
pub fn fail_with_props(
message: impl Into<String>,
permanent: bool,
props: Vec<super::bindings::frost::core::types::Kv>,
) -> Outcome {
Outcome::Failure(FailureOutcome {
message: message.into(),
permanent,
props,
})
}
}
pub mod prelude {
pub use super::bindings::exports::frost::batch::job::{
FailureOutcome, Guest as Job, MessageOutcome, Outcome, RetryOutcome,
};
pub use super::bindings::frost::core::context::Ctx;
pub use super::bindings::frost::core::diagnostics::{log, Level};
pub use super::bindings::frost::core::types::{Error, Kv, Properties};
pub use super::outcome::{fail, fail_with_props, ok, ok_with_props, retry, retry_with_props};
pub use $crate::frost_component;
}
}
};
}