2019-11-14 13:38:24 +01:00
|
|
|
use std::future::Future;
|
|
|
|
use std::pin::Pin;
|
|
|
|
use std::task::{Context, Poll};
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
use super::{Service, ServiceFactory};
|
2018-12-06 23:04:42 +01:00
|
|
|
use crate::cell::Cell;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
|
|
|
/// Service for the `then` combinator, chaining a computation onto the end of
|
|
|
|
/// another service.
|
|
|
|
///
|
|
|
|
/// This is created by the `ServiceExt::then` method.
|
2019-11-18 09:30:04 +01:00
|
|
|
pub struct ThenService<A, B> {
|
2018-10-03 06:47:50 +02:00
|
|
|
a: A,
|
2018-10-03 07:18:07 +02:00
|
|
|
b: Cell<B>,
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> ThenService<A, B> {
|
|
|
|
/// Create new `.then()` combinator
|
|
|
|
pub(crate) fn new(a: A, b: B) -> ThenService<A, B>
|
2018-11-30 03:56:15 +01:00
|
|
|
where
|
2019-03-09 15:36:23 +01:00
|
|
|
A: Service,
|
|
|
|
B: Service<Request = Result<A::Response, A::Error>, Error = A::Error>,
|
2018-11-30 03:56:15 +01:00
|
|
|
{
|
2019-11-18 09:30:04 +01:00
|
|
|
Self { a, b: Cell::new(b) }
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> Clone for ThenService<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2018-11-30 03:56:15 +01:00
|
|
|
A: Clone,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
|
|
|
fn clone(&self) -> Self {
|
2019-11-18 09:30:04 +01:00
|
|
|
ThenService {
|
2018-10-03 06:47:50 +02:00
|
|
|
a: self.a.clone(),
|
|
|
|
b: self.b.clone(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> Service for ThenService<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-03-09 15:36:23 +01:00
|
|
|
A: Service,
|
|
|
|
B: Service<Request = Result<A::Response, A::Error>, Error = A::Error>,
|
2019-11-18 09:30:04 +01:00
|
|
|
A::Future: Unpin,
|
|
|
|
B::Future: Unpin,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2019-03-09 15:36:23 +01:00
|
|
|
type Request = A::Request;
|
2018-10-03 06:47:50 +02:00
|
|
|
type Response = B::Response;
|
|
|
|
type Error = B::Error;
|
2019-11-18 09:30:04 +01:00
|
|
|
type Future = ThenServiceResponse<A, B>;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
fn poll_ready(&mut self, ctx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
|
|
|
let not_ready = !self.a.poll_ready(ctx)?.is_ready();
|
|
|
|
if !self.b.get_mut().poll_ready(ctx)?.is_ready() || not_ready {
|
|
|
|
Poll::Pending
|
2019-03-12 23:15:14 +01:00
|
|
|
} else {
|
2019-11-14 13:38:24 +01:00
|
|
|
Poll::Ready(Ok(()))
|
2019-03-12 23:15:14 +01:00
|
|
|
}
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
|
2019-03-09 15:36:23 +01:00
|
|
|
fn call(&mut self, req: A::Request) -> Self::Future {
|
2019-11-18 09:30:04 +01:00
|
|
|
ThenServiceResponse::new(self.a.call(req), self.b.clone())
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
pub struct ThenServiceResponse<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-03-09 15:36:23 +01:00
|
|
|
A: Service,
|
|
|
|
B: Service<Request = Result<A::Response, A::Error>>,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2018-10-03 07:18:07 +02:00
|
|
|
b: Cell<B>,
|
2018-10-03 06:47:50 +02:00
|
|
|
fut_b: Option<B::Future>,
|
2018-12-13 03:00:35 +01:00
|
|
|
fut_a: Option<A::Future>,
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> ThenServiceResponse<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-03-09 15:36:23 +01:00
|
|
|
A: Service,
|
|
|
|
B: Service<Request = Result<A::Response, A::Error>>,
|
2019-11-18 09:30:04 +01:00
|
|
|
A::Future: Unpin,
|
|
|
|
B::Future: Unpin,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2018-12-13 03:00:35 +01:00
|
|
|
fn new(a: A::Future, b: Cell<B>) -> Self {
|
2019-11-18 09:30:04 +01:00
|
|
|
ThenServiceResponse {
|
2018-10-03 06:47:50 +02:00
|
|
|
b,
|
2018-12-13 03:00:35 +01:00
|
|
|
fut_a: Some(a),
|
2018-10-03 06:47:50 +02:00
|
|
|
fut_b: None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> Future for ThenServiceResponse<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-03-09 15:36:23 +01:00
|
|
|
A: Service,
|
|
|
|
B: Service<Request = Result<A::Response, A::Error>>,
|
2019-11-18 09:30:04 +01:00
|
|
|
A::Future: Unpin,
|
|
|
|
B::Future: Unpin,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2019-11-14 13:38:24 +01:00
|
|
|
type Output = Result<B::Response, B::Error>;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
2019-11-18 09:30:04 +01:00
|
|
|
let this = self.get_mut();
|
2019-11-14 13:38:24 +01:00
|
|
|
|
|
|
|
loop {
|
2019-11-18 09:30:04 +01:00
|
|
|
if let Some(ref mut fut) = this.fut_b {
|
|
|
|
return Pin::new(fut).poll(cx);
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
2019-11-14 13:38:24 +01:00
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
match Pin::new(this.fut_a.as_mut().expect("Bug in actix-service")).poll(cx) {
|
2019-11-14 13:38:24 +01:00
|
|
|
Poll::Ready(r) => {
|
2019-11-18 09:30:04 +01:00
|
|
|
this.fut_b = Some(this.b.get_mut().call(r));
|
2019-11-14 13:38:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Poll::Pending => return Poll::Pending,
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
/// `.then()` service factory combinator
|
2019-11-18 09:30:04 +01:00
|
|
|
pub struct ThenServiceFactory<A, B> {
|
2018-10-03 06:47:50 +02:00
|
|
|
a: A,
|
|
|
|
b: B,
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> ThenServiceFactory<A, B>
|
2019-11-14 13:38:24 +01:00
|
|
|
where
|
|
|
|
A: ServiceFactory,
|
|
|
|
B: ServiceFactory<
|
|
|
|
Config = A::Config,
|
|
|
|
Request = Result<A::Response, A::Error>,
|
|
|
|
Error = A::Error,
|
|
|
|
InitError = A::InitError,
|
|
|
|
>,
|
|
|
|
{
|
2018-10-03 06:47:50 +02:00
|
|
|
/// Create new `AndThen` combinator
|
2019-11-18 09:30:04 +01:00
|
|
|
pub(crate) fn new(a: A, b: B) -> Self {
|
2019-11-14 13:38:24 +01:00
|
|
|
Self { a, b }
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> ServiceFactory for ThenServiceFactory<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-11-14 13:38:24 +01:00
|
|
|
A: ServiceFactory,
|
|
|
|
B: ServiceFactory<
|
2019-05-12 15:03:50 +02:00
|
|
|
Config = A::Config,
|
2019-03-09 15:36:23 +01:00
|
|
|
Request = Result<A::Response, A::Error>,
|
|
|
|
Error = A::Error,
|
|
|
|
InitError = A::InitError,
|
|
|
|
>,
|
2019-11-18 09:30:04 +01:00
|
|
|
A::Future: Unpin,
|
|
|
|
A::Service: Unpin,
|
|
|
|
<A::Service as Service>::Future: Unpin,
|
|
|
|
B::Future: Unpin,
|
|
|
|
B::Service: Unpin,
|
|
|
|
<B::Service as Service>::Future: Unpin,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2019-03-09 15:36:23 +01:00
|
|
|
type Request = A::Request;
|
2018-10-03 06:47:50 +02:00
|
|
|
type Response = B::Response;
|
|
|
|
type Error = A::Error;
|
|
|
|
|
2019-05-12 15:03:50 +02:00
|
|
|
type Config = A::Config;
|
2019-11-18 09:30:04 +01:00
|
|
|
type Service = ThenService<A::Service, B::Service>;
|
2018-10-03 06:47:50 +02:00
|
|
|
type InitError = A::InitError;
|
2019-11-18 09:30:04 +01:00
|
|
|
type Future = ThenServiceFactoryResponse<A, B>;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-05-12 15:03:50 +02:00
|
|
|
fn new_service(&self, cfg: &A::Config) -> Self::Future {
|
2019-11-18 09:30:04 +01:00
|
|
|
ThenServiceFactoryResponse::new(self.a.new_service(cfg), self.b.new_service(cfg))
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> Clone for ThenServiceFactory<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2018-11-30 03:56:15 +01:00
|
|
|
A: Clone,
|
|
|
|
B: Clone,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
|
|
|
fn clone(&self) -> Self {
|
|
|
|
Self {
|
|
|
|
a: self.a.clone(),
|
|
|
|
b: self.b.clone(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
pub struct ThenServiceFactoryResponse<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-11-14 13:38:24 +01:00
|
|
|
A: ServiceFactory,
|
|
|
|
B: ServiceFactory<
|
2019-05-12 15:03:50 +02:00
|
|
|
Config = A::Config,
|
2019-03-09 15:36:23 +01:00
|
|
|
Request = Result<A::Response, A::Error>,
|
|
|
|
Error = A::Error,
|
|
|
|
InitError = A::InitError,
|
|
|
|
>,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2019-03-05 06:35:47 +01:00
|
|
|
fut_b: B::Future,
|
|
|
|
fut_a: A::Future,
|
2018-10-03 06:47:50 +02:00
|
|
|
a: Option<A::Service>,
|
|
|
|
b: Option<B::Service>,
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> ThenServiceFactoryResponse<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-11-14 13:38:24 +01:00
|
|
|
A: ServiceFactory,
|
|
|
|
B: ServiceFactory<
|
2019-05-12 15:03:50 +02:00
|
|
|
Config = A::Config,
|
2019-03-09 15:36:23 +01:00
|
|
|
Request = Result<A::Response, A::Error>,
|
|
|
|
Error = A::Error,
|
|
|
|
InitError = A::InitError,
|
|
|
|
>,
|
2019-11-18 09:30:04 +01:00
|
|
|
A::Future: Unpin,
|
|
|
|
A::Service: Unpin,
|
|
|
|
<A::Service as Service>::Future: Unpin,
|
|
|
|
B::Future: Unpin,
|
|
|
|
B::Service: Unpin,
|
|
|
|
<B::Service as Service>::Future: Unpin,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2019-03-05 06:35:47 +01:00
|
|
|
fn new(fut_a: A::Future, fut_b: B::Future) -> Self {
|
2019-11-18 09:30:04 +01:00
|
|
|
Self {
|
2018-10-03 06:47:50 +02:00
|
|
|
fut_a,
|
|
|
|
fut_b,
|
|
|
|
a: None,
|
|
|
|
b: None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-18 09:30:04 +01:00
|
|
|
impl<A, B> Future for ThenServiceFactoryResponse<A, B>
|
2018-10-03 06:47:50 +02:00
|
|
|
where
|
2019-11-14 13:38:24 +01:00
|
|
|
A: ServiceFactory,
|
|
|
|
B: ServiceFactory<
|
2019-05-12 15:03:50 +02:00
|
|
|
Config = A::Config,
|
2019-03-09 15:36:23 +01:00
|
|
|
Request = Result<A::Response, A::Error>,
|
|
|
|
Error = A::Error,
|
|
|
|
InitError = A::InitError,
|
|
|
|
>,
|
2019-11-18 09:30:04 +01:00
|
|
|
A::Future: Unpin,
|
|
|
|
A::Service: Unpin,
|
|
|
|
<A::Service as Service>::Future: Unpin,
|
|
|
|
B::Future: Unpin,
|
|
|
|
B::Service: Unpin,
|
|
|
|
<B::Service as Service>::Future: Unpin,
|
2018-10-03 06:47:50 +02:00
|
|
|
{
|
2019-11-18 09:30:04 +01:00
|
|
|
type Output = Result<ThenService<A::Service, B::Service>, A::InitError>;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
2019-11-18 09:30:04 +01:00
|
|
|
let this = self.get_mut();
|
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
if this.a.is_none() {
|
2019-11-18 09:30:04 +01:00
|
|
|
if let Poll::Ready(service) = Pin::new(&mut this.fut_a).poll(cx)? {
|
|
|
|
this.a = Some(service);
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
2019-11-14 13:38:24 +01:00
|
|
|
if this.b.is_none() {
|
2019-11-18 09:30:04 +01:00
|
|
|
if let Poll::Ready(service) = Pin::new(&mut this.fut_b).poll(cx)? {
|
|
|
|
this.b = Some(service);
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
2019-11-14 13:38:24 +01:00
|
|
|
if this.a.is_some() && this.b.is_some() {
|
2019-11-18 09:30:04 +01:00
|
|
|
Poll::Ready(Ok(ThenService::new(
|
2019-11-14 13:38:24 +01:00
|
|
|
this.a.take().unwrap(),
|
|
|
|
this.b.take().unwrap(),
|
2018-10-03 06:47:50 +02:00
|
|
|
)))
|
|
|
|
} else {
|
2019-11-14 13:38:24 +01:00
|
|
|
Poll::Pending
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use std::cell::Cell;
|
|
|
|
use std::rc::Rc;
|
2019-11-14 13:38:24 +01:00
|
|
|
use std::task::{Context, Poll};
|
|
|
|
|
|
|
|
use futures::future::{err, lazy, ok, ready, Ready};
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
use crate::{pipeline, pipeline_factory, Service, ServiceFactory};
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2018-10-03 07:18:07 +02:00
|
|
|
#[derive(Clone)]
|
2018-10-03 06:47:50 +02:00
|
|
|
struct Srv1(Rc<Cell<usize>>);
|
2019-11-14 13:38:24 +01:00
|
|
|
|
2019-03-09 15:36:23 +01:00
|
|
|
impl Service for Srv1 {
|
|
|
|
type Request = Result<&'static str, &'static str>;
|
2018-10-03 06:47:50 +02:00
|
|
|
type Response = &'static str;
|
|
|
|
type Error = ();
|
2019-11-14 13:38:24 +01:00
|
|
|
type Future = Ready<Result<Self::Response, Self::Error>>;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
2018-10-03 06:47:50 +02:00
|
|
|
self.0.set(self.0.get() + 1);
|
2019-11-14 13:38:24 +01:00
|
|
|
Poll::Ready(Ok(()))
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
|
2018-11-30 04:17:02 +01:00
|
|
|
fn call(&mut self, req: Result<&'static str, &'static str>) -> Self::Future {
|
2018-10-03 06:47:50 +02:00
|
|
|
match req {
|
|
|
|
Ok(msg) => ok(msg),
|
|
|
|
Err(_) => err(()),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Srv2(Rc<Cell<usize>>);
|
|
|
|
|
2019-03-09 15:36:23 +01:00
|
|
|
impl Service for Srv2 {
|
|
|
|
type Request = Result<&'static str, ()>;
|
2018-10-03 06:47:50 +02:00
|
|
|
type Response = (&'static str, &'static str);
|
|
|
|
type Error = ();
|
2019-11-14 13:38:24 +01:00
|
|
|
type Future = Ready<Result<Self::Response, ()>>;
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
2018-10-03 06:47:50 +02:00
|
|
|
self.0.set(self.0.get() + 1);
|
2019-11-14 13:38:24 +01:00
|
|
|
Poll::Ready(Err(()))
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
|
2018-11-30 04:17:02 +01:00
|
|
|
fn call(&mut self, req: Result<&'static str, ()>) -> Self::Future {
|
2018-10-03 06:47:50 +02:00
|
|
|
match req {
|
|
|
|
Ok(msg) => ok((msg, "ok")),
|
|
|
|
Err(()) => ok(("srv2", "err")),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
#[tokio::test]
|
|
|
|
async fn test_poll_ready() {
|
2018-10-03 06:47:50 +02:00
|
|
|
let cnt = Rc::new(Cell::new(0));
|
2019-11-14 13:38:24 +01:00
|
|
|
let mut srv = pipeline(Srv1(cnt.clone())).then(Srv2(cnt.clone()));
|
|
|
|
let res = lazy(|cx| srv.poll_ready(cx)).await;
|
|
|
|
assert_eq!(res, Poll::Ready(Err(())));
|
2018-10-03 06:47:50 +02:00
|
|
|
assert_eq!(cnt.get(), 2);
|
|
|
|
}
|
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
#[tokio::test]
|
|
|
|
async fn test_call() {
|
2018-10-03 06:47:50 +02:00
|
|
|
let cnt = Rc::new(Cell::new(0));
|
2019-11-14 13:38:24 +01:00
|
|
|
let mut srv = pipeline(Srv1(cnt.clone())).then(Srv2(cnt));
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
let res = srv.call(Ok("srv1")).await;
|
2018-10-03 06:47:50 +02:00
|
|
|
assert!(res.is_ok());
|
2019-11-14 13:38:24 +01:00
|
|
|
assert_eq!(res.unwrap(), (("srv1", "ok")));
|
2018-10-03 06:47:50 +02:00
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
let res = srv.call(Err("srv")).await;
|
2018-10-03 06:47:50 +02:00
|
|
|
assert!(res.is_ok());
|
2019-11-14 13:38:24 +01:00
|
|
|
assert_eq!(res.unwrap(), (("srv2", "err")));
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
|
2019-11-14 13:38:24 +01:00
|
|
|
#[tokio::test]
|
|
|
|
async fn test_factory() {
|
2018-10-03 06:47:50 +02:00
|
|
|
let cnt = Rc::new(Cell::new(0));
|
|
|
|
let cnt2 = cnt.clone();
|
2019-11-14 13:38:24 +01:00
|
|
|
let blank = move || ready(Ok::<_, ()>(Srv1(cnt2.clone())));
|
|
|
|
let factory = pipeline_factory(blank).then(move || ready(Ok(Srv2(cnt.clone()))));
|
|
|
|
let mut srv = factory.new_service(&()).await.unwrap();
|
|
|
|
let res = srv.call(Ok("srv1")).await;
|
|
|
|
assert!(res.is_ok());
|
|
|
|
assert_eq!(res.unwrap(), (("srv1", "ok")));
|
|
|
|
|
|
|
|
let res = srv.call(Err("srv")).await;
|
|
|
|
assert!(res.is_ok());
|
|
|
|
assert_eq!(res.unwrap(), (("srv2", "err")));
|
2018-10-03 06:47:50 +02:00
|
|
|
}
|
|
|
|
}
|