ServiceReply

Enum ServiceReply 

Source
pub enum ServiceReply<T: Serialize, E> {
    Ok {
        result: T,
    },
    Err {
        reason: String,
        msg: Option<String>,
        _e: E,
    },
}

Variants§

§

Ok

Fields

§result: T
§

Err

Fields

§reason: String
§_e: E

Trait Implementations§

Source§

impl<T, E> From<E> for ServiceReply<T, E>
where T: Serialize, E: Debug + Error,

Source§

fn from(e: E) -> ServiceReply<T, E>

Converts to this type from the input type.
Source§

impl<T, E> From<Result<T, E>> for ServiceReply<T, E>
where T: Serialize, E: Debug + Error,

Source§

fn from(res: Result<T, E>) -> ServiceReply<T, E>

Converts to this type from the input type.
Source§

impl<T, E> Reply<T, E> for ServiceReply<T, E>
where T: Serialize + 'static, E: From<Error> + Debug + Error + 'static,

Source§

fn reply(&self, status: StatusCode) -> HyperFuture

write reply body
Source§

fn serv_state<F, S, Req>(state: S, f: F) -> HyperService
where Self: 'static, F: for<'a> Fn(&'a S, Req) -> Box<dyn Future<Item = T, Error = E>> + 'static, S: 'static, Req: for<'de> Deserialize<'de> + 'static,

serv_state build HyperService with given function F and state S.
Source§

fn serv<F, Req>(f: F) -> HyperService
where Self: 'static, F: Fn(Req) -> Box<dyn Future<Item = T, Error = E>> + 'static, Req: for<'de> Deserialize<'de> + 'static,

service builds HyperService with given function F.
Source§

fn serv_state_sync<F, S, Req>(state: S, f: F) -> HyperService
where Self: 'static, F: for<'a> Fn(&'a S, Req) -> Result<T, E> + 'static, S: 'static, Req: for<'de> Deserialize<'de> + 'static,

serv_state builds HyperService with given function F and state S.
Source§

fn serv_sync<F, Req>(f: F) -> HyperService
where Self: 'static, F: Fn(Req) -> Result<T, E> + 'static, Req: for<'de> Deserialize<'de> + 'static,

serv build HyperService with given function F.
Source§

impl<T, E> Serialize for ServiceReply<T, E>
where T: Serialize + Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for ServiceReply<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for ServiceReply<T, E>

§

impl<T, E> Send for ServiceReply<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for ServiceReply<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for ServiceReply<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for ServiceReply<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.