1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use std::ops::Deref;

use futures::Future;
use http::StatusCode;

use crate::body::IngestBody;
use crate::error::HttpError;

/// A response from the LogDNA Ingest API
#[derive(Debug, PartialEq)]
pub enum Response<T>
    where T: Deref<Target=IngestBody> + Send + 'static,
          T: Clone,
{
    Sent,
    // contains the failed body, a status code and a reason the request failed(String)
    Failed(T, StatusCode, String),
}

/// Type alias for a response from `Client::send`
pub type IngestResponse<T> = Box<dyn Future<Item=Response<T>, Error=HttpError<T>> + Send + 'static>;