Make Middleware always Send + Sync + 'static
This commit is contained in:
@@ -43,7 +43,7 @@ pub struct AgentBuilder {
|
||||
#[cfg(feature = "cookies")]
|
||||
cookie_store: Option<CookieStore>,
|
||||
resolver: ArcResolver,
|
||||
middleware: Vec<Box<dyn Middleware + Send + Sync>>,
|
||||
middleware: Vec<Box<dyn Middleware>>,
|
||||
}
|
||||
|
||||
/// Config as built by AgentBuilder and then static for the lifetime of the Agent.
|
||||
@@ -111,7 +111,7 @@ pub(crate) struct AgentState {
|
||||
#[cfg(feature = "cookies")]
|
||||
pub(crate) cookie_tin: CookieTin,
|
||||
pub(crate) resolver: ArcResolver,
|
||||
pub(crate) middleware: Vec<Box<dyn Middleware + Send + Sync>>,
|
||||
pub(crate) middleware: Vec<Box<dyn Middleware>>,
|
||||
}
|
||||
|
||||
impl Agent {
|
||||
@@ -601,7 +601,7 @@ impl AgentBuilder {
|
||||
///
|
||||
/// All requests made by the agent will use this middleware. Middleware is invoked
|
||||
/// in the order they are added to the builder.
|
||||
pub fn middleware(mut self, m: impl Middleware + Send + Sync + 'static) -> Self {
|
||||
pub fn middleware(mut self, m: impl Middleware) -> Self {
|
||||
self.middleware.push(Box::new(m));
|
||||
self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user