state: Add an Error type alias to ZebraState

This commit is contained in:
teor 2020-06-10 20:39:51 +10:00 committed by Henry de Valence
parent 4181c8a5d5
commit 8072d5b7e8
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
use super::{Request, Response};
use futures::prelude::*;
use std::{
error::Error,
error,
future::Future,
pin::Pin,
task::{Context, Poll},
@ -15,9 +15,11 @@ struct ZebraState {
index: block_index::BlockIndex,
}
type Error = Box<dyn error::Error + Send + Sync + 'static>;
impl Service<Request> for ZebraState {
type Response = Response;
type Error = Box<dyn Error + Send + Sync + 'static>;
type Error = Error;
type Future =
Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>;
@ -58,8 +60,8 @@ impl Service<Request> for ZebraState {
pub fn init() -> impl Service<
Request,
Response = Response,
Error = Box<dyn Error + Send + Sync + 'static>,
Future = impl Future<Output = Result<Response, Box<dyn Error + Send + Sync + 'static>>>,
Error = Error,
Future = impl Future<Output = Result<Response, Error>>,
> + Send
+ Clone
+ 'static {