pub trait ResourceProvider:
Send
+ Sync
+ 'static {
// Required method
fn request(&self, request: ResourceRequest);
// Provided method
fn serves(&self, _kind: Kind, _url: &str) -> bool { ... }
}Expand description
Serves a runtime’s network requests in place of the library.
A closure Fn(ResourceRequest) is a provider that serves every request.
The library loads only http and https, so without a resource
transform, a request for another scheme that no provider serves fails at
once.
Required Methods§
Sourcefn request(&self, request: ResourceRequest)
fn request(&self, request: ResourceRequest)
Serves request: answer it with ResourceRequest::respond, or hand
it back with ResourceRequest::pass_through, now or later and on
any thread. It runs on a thread of the library’s, which waits for it,
and so does a replacement of the provider, so it should hand slow
work elsewhere.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".