Skip to main content

GutterFunc

Type Alias GutterFunc 

Source
pub type GutterFunc = Box<dyn Fn(GutterContext) -> String + Send + Sync>;
Expand description

GutterFunc can be implemented and set into Model::left_gutter_func.

Example implementation showing line numbers:

fn line_numbers(info: GutterContext) -> String {
    if info.soft {
        return "     โ”‚ ".to_string();
    }
    if info.index >= info.total_lines {
        return "   ~ โ”‚ ".to_string();
    }
    format!("{:4} โ”‚ ", info.index + 1)
}

Aliased Typeยง

pub struct GutterFunc(/* private fields */);