[BOT-272] ClientBuilder extend convenience function

This commit is contained in:
Stefan Adrian Danaita 2024-05-03 03:29:33 +01:00 committed by Ethan Brierley
parent c558e7414a
commit d406eb2ce7

View file

@ -31,6 +31,14 @@ impl ClientBuilder {
}
}
/// Convenience method to extend a ClientBuilder instance by appending
/// the middleware and initialiser stacks from a ClientwithMiddleware
pub fn extend(mut self, client_with_middleware: ClientWithMiddleware) -> Self {
self.middleware_stack.append(&mut client_with_middleware.middleware_stack.into_vec());
self.initialiser_stack.append(&mut client_with_middleware.initialiser_stack.into_vec());
self
}
/// Convenience method to attach middleware.
///
/// If you need to keep a reference to the middleware after attaching, use [`with_arc`].