1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) Mysten Labs, Inc.
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use http::{request, response};

mod future;
mod layer;
mod service;

pub use self::{future::ResponseFuture, layer::CallbackLayer, service::Callback};

pub trait MakeCallbackHandler {
    type Handler: ResponseHandler;

    fn make_handler(&self, request: &request::Parts) -> Self::Handler;
}

pub trait ResponseHandler {
    fn on_response(self, response: &response::Parts);
    fn on_error<E>(self, error: &E);
}