Trait hcl::format::Format

source ·
pub trait Format: Sealed {
    // Required method
    fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>
       where W: Write;

    // Provided methods
    fn format_vec<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<Vec<u8>>
       where W: Write + AsMut<Vec<u8>> { ... }
    fn format_string<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<String>
       where W: Write + AsMut<Vec<u8>> { ... }
}
Expand description

A trait to format data structures as HCL.

This trait is sealed to prevent implementation outside of this crate.

Required Methods§

source

fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where W: Write,

Formats a HCL structure using a formatter and writes the result to the provided writer.

Errors

Formatting the data structure or writing to the writer may fail with an Error.

Provided Methods§

source

fn format_vec<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<Vec<u8>>where W: Write + AsMut<Vec<u8>>,

Formats a HCL structure using a formatter and returns the result as a Vec<u8>.

Errors

Formatting the data structure or writing to the writer may fail with an Error.

source

fn format_string<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<String>where W: Write + AsMut<Vec<u8>>,

Formats a HCL structure using a formatter and returns the result as a String.

Errors

Formatting the data structure or writing to the writer may fail with an Error.

Implementations on Foreign Types§

source§

impl<T> Format for &Twhere T: Format,

source§

fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where W: Write,

source§

impl Format for String

source§

fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where W: Write,

Implementors§