use jsonrpc_core::futures_util::{future::Either, FutureExt};
use jsonrpc_core::*;
use std::future::Future;
use std::sync::atomic::{self, AtomicUsize};
use std::time::Instant;
#[derive(Clone, Debug)]
struct Meta(usize);
impl Metadata for Meta {}
#[derive(Default)]
struct MyMiddleware(AtomicUsize);
impl Middleware for MyMiddleware {
type Future = FutureResponse;
type CallFuture = middleware::NoopCallFuture;
fn on_request(&self, request: Request, meta: Meta, next: F) -> Either
where
F: FnOnce(Request, Meta) -> X + Send,
X: Future