Struct quickmd::assets::Assets[][src]

pub struct Assets { /* fields omitted */ }
Expand description

A container for static assets.

Builds everything in either the explicitly-given directory, or a temporary one. Internally reference-counted, so clones share the same storage.

Implementations

Create a new instance. It should never be necessary to create more than one, but it’s possible.

If the optional output_dir parameter is not given, the instance will use a temporary directory.

If output_dir doesn’t exist, it will be recursively created.

Given an HTML fragment, wrap it up in whatever is necessary to turn it into a proper preview page and write it to a file.

Input:

  • content: The rendered HTML to write to a file, with some additional metadata.
  • page_state: Client-side data to embed in the document, so it can read it via javascript and maintain continuity with the previous load.

Returns the path to the generated HTML file, or an error.

The path on the filesystem where the HTML and other assets go. Could be a temporary directory, or the one given at construction time.

Delete the temporary directory used for building assets, if there is one. This should happen automatically on drop, but a GTK-level exit doesn’t seem to unroll the stack, so we may need to delete things explicitly.

If deletion fails, we quietly print a warning. Multiple (successful or failed) deletions are a noop.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.