Trait pixel_widgets::loader::Loader[][src]

pub trait Loader: Send + Sync {
    type Load: Future<Output = Result<Vec<u8>, Self::Error>> + Send;
    type Wait: Future<Output = Result<(), Self::Error>> + Send;
    type Error: 'static + Error + Send + Sync;
    fn load(&self, url: impl AsRef<str>) -> Self::Load;
fn wait(&self, url: impl AsRef<str>) -> Self::Wait; }
Expand description

A way to load URLs from a data source.

Included implementations:

  • PathBuf, loads data from disk using the PathBuf as working directory.

Associated Types

type Load: Future<Output = Result<Vec<u8>, Self::Error>> + Send[src]

A future returned when calling load.

type Wait: Future<Output = Result<(), Self::Error>> + Send[src]

A future returned when calling wait.

type Error: 'static + Error + Send + Sync[src]

Error returned by the loader when the request failed.

Required methods

fn load(&self, url: impl AsRef<str>) -> Self::Load[src]

Asynchronously load a resource located at the given url

fn wait(&self, url: impl AsRef<str>) -> Self::Wait[src]

Wait for a resource to be modified externally.

Implementors

impl Loader for FsLoader[src]

type Load = Ready<Result<Vec<u8>, Self::Error>>

type Wait = Map<Receiver<Result<(), Self::Error>>, fn(_: Result<Result<(), Self::Error>, Canceled>) -> Result<(), Self::Error>>

type Error = Error

fn load(&self, url: impl AsRef<str>) -> Self::Load[src]

fn wait(&self, url: impl AsRef<str>) -> Self::Wait[src]