Skip to main content

LayoutPolicy

Type Alias LayoutPolicy 

Source
pub type LayoutPolicy = FormatPolicy;
Expand description

Runtime layout policy for decorate and pretty_with_protocol.

Aliased to FormatPolicy: the emitter’s own policy struct is exactly the put-direction complement of the parse/emit lens, so the two are one type.

Aliased Type§

pub struct LayoutPolicy {
    pub indent_width: usize,
    pub separator: String,
    pub newline: String,
    pub line_break_after: Vec<String>,
    pub indent_open: Vec<String>,
    pub indent_close: Vec<String>,
}

Fields§

§indent_width: usize

Number of spaces per indent level.

§separator: String

Separator inserted between adjacent terminals that the lexer would otherwise glue together (word ↔ word, operator ↔ operator). Default is a single space.

§newline: String

Newline byte sequence emitted after line_break_after tokens and at end-of-output. Default is "\n".

§line_break_after: Vec<String>

Tokens after which the walker breaks to a new line.

§indent_open: Vec<String>

Tokens that increase indent on emission.

§indent_close: Vec<String>

Tokens that decrease indent on emission.