Struct rofl::Engine [] [src]

pub struct Engine<Tl = TemplateLoader, Fl = FontLoader> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
{ /* fields omitted */ }

Image captioning engine.

The engine is thread-safe (Sync) since normally you'd want the captioning to be performed in a background thread.

Note: Engine implements Clone by merely cloning a shared reference to the underlying object.

Methods

impl Engine<TemplateLoader, FontLoader>
[src]

Create an Engine which loads templates & fonts from given directory paths. When loaded, both resources will be cached in memory (LRU cache).

impl<Tl, Fl> Engine<Tl, Fl> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
[src]

Create an Engine that uses given loaders for templates & font. When loaded, both resources will be cached in memory (LRU cache).

Create an Engine that uses given template & font loaders directly. Any caching scheme, if necessary, should be implemented by loaders themselves.

impl<Tl, Fl> Engine<Tl, Fl> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
[src]

Render a given image macro by captioning the template with the specified text(s).

Note that captioning is a CPU-intensive process and can be relatively lengthy, especially if the template is an animated GIF. It is recommended to execute it in a separate thread.

impl<Tl, Fl> Engine<Tl, Fl> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
[src]

Preemptively load a template into engine's cache.

Preemptively load a font into engine's cache.

Return a reference to the internal template cache, if any. This can be used to examine cache statistics (hits & misses).

Return a reference to the internal font cache, if any. This can be used to examine cache statistics (hits & misses).

Trait Implementations

impl<Tl: Clone, Fl: Clone> Clone for Engine<Tl, Fl> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Tl: Debug, Fl: Debug> Debug for Engine<Tl, Fl> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
[src]

Formats the value using the given formatter.

impl<Tl, Fl> From<Inner<Tl, Fl>> for Engine<Tl, Fl> where
    Tl: Loader<Item = Template>,
    Fl: Loader<Item = Font>, 
[src]

Performs the conversion.