allora_http/
adapter_dsl.rs

1use crate::{HttpInboundBuilder, HttpOutboundAdapterBuilder};
2pub(crate) use allora_core::adapter::{InboundStage, OutboundStage};
3
4/// Extension trait adding `.http()` to the core `InboundStage`.
5pub trait InboundHttpExt {
6    /// Begin building an HTTP inbound adapter (server) from the core adapter DSL.
7    fn http(self) -> HttpInboundBuilder;
8}
9
10impl InboundHttpExt for InboundStage {
11    fn http(self) -> HttpInboundBuilder {
12        HttpInboundBuilder::new()
13    }
14}
15
16/// Extension trait adding `.http()` to the core `OutboundStage`.
17pub trait OutboundHttpExt {
18    /// Begin building an HTTP outbound adapter (client) from the core adapter DSL.
19    fn http(self) -> HttpOutboundAdapterBuilder;
20}
21
22impl OutboundHttpExt for OutboundStage {
23    fn http(self) -> HttpOutboundAdapterBuilder {
24        HttpOutboundAdapterBuilder::default()
25    }
26}