pub struct AsyncHeaderInjector { /* private fields */ }Expand description
Async header injector that can await external state (for example token refresh) before mutating outbound request headers.
Implementations§
Source§impl AsyncHeaderInjector
impl AsyncHeaderInjector
Sourcepub fn new<F>(injector: F) -> Self
pub fn new<F>(injector: F) -> Self
Creates an async header injector from a callback.
§Parameters
injector: Async callback that mutatesHeaderMapand may fail.
§Returns
New AsyncHeaderInjector.
Sourcepub async fn apply(&self, headers: &mut HeaderMap) -> HttpResult<()>
pub async fn apply(&self, headers: &mut HeaderMap) -> HttpResult<()>
Applies this injector to headers.
§Parameters
headers: Header map to mutate.
§Returns
Ok(()) on success.
§Errors
Propagates callback-provided crate::HttpError.
Trait Implementations§
Source§impl Clone for AsyncHeaderInjector
impl Clone for AsyncHeaderInjector
Source§fn clone(&self) -> AsyncHeaderInjector
fn clone(&self) -> AsyncHeaderInjector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AsyncHeaderInjector
impl !RefUnwindSafe for AsyncHeaderInjector
impl Send for AsyncHeaderInjector
impl Sync for AsyncHeaderInjector
impl Unpin for AsyncHeaderInjector
impl UnsafeUnpin for AsyncHeaderInjector
impl !UnwindSafe for AsyncHeaderInjector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more