Skip to main content

FileSource

Trait FileSource 

Source
pub trait FileSource: Send + Sync {
    // Required methods
    fn load(&self, resource: &Resource, responder: Responder);
    fn can_request(&self, resource: &Resource) -> bool;

    // Provided method
    fn supports_cache_only(&self) -> bool { ... }
}
Expand description

A source of resources. File sources are shared between threads, hence Send + Sync. Each takes its configuration when it’s made, or through methods of its own type.

Required Methods§

Source

fn load(&self, resource: &Resource, responder: Responder)

Starts loading resource, and sends its responses to responder from any thread. It returns at once.

Source

fn can_request(&self, resource: &Resource) -> bool

Whether this file source loads resource.

Provided Methods§

Source

fn supports_cache_only(&self) -> bool

Whether this file source answers cache-only requests: ones that are worth answering only cheaply, from a local cache, to cover part of the map while it loads.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§