util: derive Clone for ServiceFn (#245)

This commit is contained in:
Sean McArthur 2019-04-10 12:02:15 -07:00 committed by GitHub
parent 0f58e50c3d
commit 1012b20737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -2,12 +2,13 @@ use futures::{IntoFuture, Poll};
use tower_service::Service;
/// A `Service` implemented by a closure.
#[derive(Copy, Clone, Debug)]
pub struct ServiceFn<T> {
f: T,
}
impl<T> ServiceFn<T> {
/// Returns a new `NewServiceFn` with the given closure.
/// Returns a new `ServiceFn` with the given closure.
pub fn new(f: T) -> Self {
ServiceFn { f }
}