Skip to main content

Layout

Trait Layout 

Source
pub trait Layout: Sized + 'static {
    // Required methods
    fn v_open() -> Self;
    fn v_close() -> Self;
    fn v_sep() -> Self;
}
Expand description

Token types that participate in layout must implement Layout so the lexer can construct virtual open/close/separator tokens to splice into the stream.

The user’s token enum picks names for these three variants (e.g. VOpen/VClose/VSemi, or Indent/Dedent/Newline). Only the three constructor methods are required; classification of which real tokens open a block is configured separately via LayoutConfig.

Required Methods§

Source

fn v_open() -> Self

Construct a virtual open-block token.

Source

fn v_close() -> Self

Construct a virtual close-block token.

Source

fn v_sep() -> Self

Construct a virtual separator (semicolon-equivalent) between siblings inside the same layout block.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§