fundamentum_edge_mcu_http_client/
http_handler.rs

1#[cfg(test)]
2use core::fmt::Debug;
3use core::future::Future;
4
5#[cfg(feature = "log")]
6use defmt::Format;
7
8use crate::models::HttpRequest;
9
10/// Types which are able to perform an HTTP request to a Web server.
11pub trait HttpHandler {
12    /// Error type
13    #[cfg(all(not(test), feature = "log"))]
14    type Error: Format;
15    /// Error type
16    #[cfg(all(test, feature = "log"))]
17    type Error: Format + Debug + PartialEq;
18    /// Error type
19    #[cfg(all(not(test), not(feature = "log")))]
20    type Error;
21    /// Error type
22    #[cfg(all(test, not(feature = "log")))]
23    type Error: Debug + PartialEq;
24
25    /// Perform an asynchronous HTTP call
26    fn http_call<'a, 'd>(
27        &'a self,
28        request: HttpRequest,
29        out_buffer: &'d mut [u8],
30    ) -> impl Future<Output = Result<(), Self::Error>>;
31}