Skip to main content

Files

Trait Files 

Source
pub trait Files {
    // Required method
    fn bytes(&self, path: &str) -> Option<Vec<u8>>;

    // Provided methods
    fn read(&self, path: &str) -> Option<String> { ... }
    fn image(&self, path: &str) -> Option<Result<Arc<ImageFile>, String>> { ... }
}
Expand description

Reads a design’s files by their path from the top of the served folder.

Required Methods§

Source

fn bytes(&self, path: &str) -> Option<Vec<u8>>

A file’s bytes: a design’s text, or an Image’s file.

Provided Methods§

Source

fn read(&self, path: &str) -> Option<String>

A design file’s text.

Source

fn image(&self, path: &str) -> Option<Result<Arc<ImageFile>, String>>

The image file at path, decoded, or why it doesn’t decode; None when there is no such file. A store that keeps files between resolves keeps their decoded images too, so a save doesn’t decode them again.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Files for HashMap<String, String>

Source§

fn bytes(&self, path: &str) -> Option<Vec<u8>>

Implementors§