add clone impl
This commit is contained in:
parent
9d8e67bfbe
commit
336b8957a7
1 changed files with 12 additions and 0 deletions
|
|
@ -412,6 +412,18 @@ impl<T: Clone> Deref for Data<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Clone> Clone for Data<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Data { config: self.config.clone(), request_counter: self.request_counter.load(Ordering::Relaxed).into() }
|
||||
}
|
||||
|
||||
fn clone_from(&mut self, source: &Self) {
|
||||
let Data { config, request_counter } = self;
|
||||
config.clone_from(&source.config);
|
||||
*request_counter.get_mut() = source.request_counter.load(Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
/// Middleware for HTTP handlers which provides access to [Data]
|
||||
#[derive(Clone)]
|
||||
pub struct FederationMiddleware<T: Clone>(pub(crate) FederationConfig<T>);
|
||||
|
|
|
|||
Loading…
Reference in a new issue