pub struct ResourceTransform {
pub callback: Option<Arc<dyn Fn(ResourceKind, &str, ResourceTransformRequestHandle) + Send + Sync + 'static>>,
pub rules: Vec<ResourceTransformRule>,
}Expand description
How to rewrite request URLs, for RuntimeHandle::set_resource_transform().
Set either callback or rules, not both.
See mln_resource_transform in the
C API reference.
Fields§
§callback: Option<Arc<dyn Fn(ResourceKind, &str, ResourceTransformRequestHandle) + Send + Sync + 'static>>The callback receives (kind, url, request).
rules: Vec<ResourceTransformRule>The first rule that matches a request adds its parameters, and no other. A request that no rule matches keeps its URL.
Implementations§
Source§impl ResourceTransform
impl ResourceTransform
pub fn with_callback<F>(self, callback: F) -> Self
pub fn new<F>(callback: F) -> Self
Trait Implementations§
Source§impl Clone for ResourceTransform
impl Clone for ResourceTransform
Source§fn clone(&self) -> ResourceTransform
fn clone(&self) -> ResourceTransform
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 ResourceTransform
impl Debug for ResourceTransform
Source§impl Default for ResourceTransform
impl Default for ResourceTransform
Source§fn default() -> ResourceTransform
fn default() -> ResourceTransform
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ResourceTransform
impl !UnwindSafe for ResourceTransform
impl Freeze for ResourceTransform
impl Send for ResourceTransform
impl Sync for ResourceTransform
impl Unpin for ResourceTransform
impl UnsafeUnpin for ResourceTransform
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