Skip to main content

loader_fn

Function loader_fn 

Source
pub fn loader_fn<F, Fut>(f: F) -> LoaderFn
where F: Fn(String) -> Fut + 'static, Fut: Future<Output = Result<String, String>> + 'static,
Expand description

Builds a LoaderFn from a closure that takes the URI and returns a future.

ยงExamples

use texl_core::loader_fn;

let loader = loader_fn(|uri| async move {
    Ok(format!("This is <% \"{uri}\" %>"))
});