FormatCode

Trait FormatCode 

Source
pub trait FormatCode {
    // Required methods
    fn format_into_vec_with(
        &self,
        format: &Format,
        out: &mut Vec<String>,
        connect: bool,
        indent: &str,
    );
    fn size_hint(&self) -> usize;

    // Provided methods
    fn format(&self) -> String { ... }
    fn format_with(&self, format: &Format) -> String { ... }
    fn format_vec_with(&self, format: &Format) -> Vec<String> { ... }
}
Expand description

Enable different formatting options for Code structures

Required Methods§

Source

fn format_into_vec_with( &self, format: &Format, out: &mut Vec<String>, connect: bool, indent: &str, )

Emit self with the format in the given output context

Source

fn size_hint(&self) -> usize

Upperbound for the line count of the code for pre-allocating. Return 0 to skip

Provided Methods§

Source

fn format(&self) -> String

Emit self with the default format as a string

Source

fn format_with(&self, format: &Format) -> String

Emit self with the format as a string

Source

fn format_vec_with(&self, format: &Format) -> Vec<String>

Emit self with the format as a vector of lines

Implementors§