pub struct HttpHeaderTransform {
pub callback: Option<Arc<dyn Fn(ResourceKind, &str, &mut HttpHeaderTransformResponse<'_>) -> Result<()> + Send + Sync + 'static>>,
pub rules: Vec<HttpHeaderRule>,
}Expand description
Headers to add to HTTP requests, for
RuntimeHandle::set_http_header_transform().
Set either callback or rules, not both.
Runs on a library thread.
See mln_http_header_transform in the
C API reference.
Fields§
§callback: Option<Arc<dyn Fn(ResourceKind, &str, &mut HttpHeaderTransformResponse<'_>) -> Result<()> + Send + Sync + 'static>>The callback receives (kind, url, out_response).
An Err of Error::Status with a failure status answers native
that status. Any other error, or a panic, reaches the reporter and
answers Status::NativeError.
rules: Vec<HttpHeaderRule>The first rule that matches a request adds its headers, and no other.
Implementations§
Source§impl HttpHeaderTransform
impl HttpHeaderTransform
pub fn with_callback<F>(self, callback: F) -> Selfwhere
F: Fn(ResourceKind, &str, &mut HttpHeaderTransformResponse<'_>) -> Result<()> + Send + Sync + 'static,
pub fn new<F>(callback: F) -> Selfwhere
F: Fn(ResourceKind, &str, &mut HttpHeaderTransformResponse<'_>) -> Result<()> + Send + Sync + 'static,
Trait Implementations§
Source§impl Clone for HttpHeaderTransform
impl Clone for HttpHeaderTransform
Source§fn clone(&self) -> HttpHeaderTransform
fn clone(&self) -> HttpHeaderTransform
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpHeaderTransform
impl Debug for HttpHeaderTransform
Source§impl Default for HttpHeaderTransform
impl Default for HttpHeaderTransform
Source§fn default() -> HttpHeaderTransform
fn default() -> HttpHeaderTransform
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for HttpHeaderTransform
impl !UnwindSafe for HttpHeaderTransform
impl Freeze for HttpHeaderTransform
impl Send for HttpHeaderTransform
impl Sync for HttpHeaderTransform
impl Unpin for HttpHeaderTransform
impl UnsafeUnpin for HttpHeaderTransform
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more