pub trait TemplateShipper: Send + Sync {
// Required methods
fn warn(&self, detail: String);
fn ship(&self, file: ShippedFile) -> Result<String, String>;
}Expand description
The handle through which a template engine ships a file, and reports a warning, while it
applies a compose template (TemplateEngine::render, TemplateEngine::render_text;
TemplateEngine::artifacts reports a warning through it).
The composer makes one per application of a compose template and gives it to every call of that application.
Required Methods§
Sourcefn warn(&self, detail: String)
fn warn(&self, detail: String)
Hands the composer the warning detail, a text for a person to read that states
what is wrong (for instance a downloaded file whose kept copy was used past its
expiry). The compose template is still applied; the composer reports each warning
as a TemplateWarning, in the order first given. Giving the same text again in
the same application reports nothing more.
Sourcefn ship(&self, file: ShippedFile) -> Result<String, String>
fn ship(&self, file: ShippedFile) -> Result<String, String>
Hands file to the composer, which writes it beside the entry artifact, and
returns the file’s path, as a compose template reads the paths of the files it
ships (TemplateContext::artifacts). Shipping the same file again returns the
same path and ships nothing more.
§Errors
Returns a text, for a person to read, that says why the file cannot be shipped: for instance no package in use provides the program’s naming of files. A template engine reports it as it is, and the compose template cannot be applied.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".