Skip to main content

Format

Trait Format 

Source
pub trait Format {
    // Required method
    fn write(
        &mut self,
        req: &WriteRequest,
        sets: &mut ResultSets<'_>,
    ) -> Result<Vec<String>>;

    // Provided methods
    fn options(&self) -> Vec<OptionField> { ... }
    fn validate(&self, _options: &Map<String, Value>) -> Vec<String> { ... }
    fn validate_template(
        &self,
        _options: &Map<String, Value>,
        _template: &Value,
    ) -> (Vec<String>, Vec<String>) { ... }
}

Required Methods§

Source

fn write( &mut self, req: &WriteRequest, sets: &mut ResultSets<'_>, ) -> Result<Vec<String>>

Write every result set to req.path (and siblings, if the format needs several files); return the files written.

Provided Methods§

Source

fn options(&self) -> Vec<OptionField>

The options this format takes: every key of a report’s output: block except format, destination, template and extension, which core owns.

Source

fn validate(&self, _options: &Map<String, Value>) -> Vec<String>

Problems the declared Format::options can’t catch, each a sentence naming the key. Only called on options whose declared types already passed.

Source

fn validate_template( &self, _options: &Map<String, Value>, _template: &Value, ) -> (Vec<String>, Vec<String>)

Problems with the output’s template (validate’s template, sent for the formats core gives a template context): errors, then warnings. Only called when the options passed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§