Skip to main content

FormatVariables

Trait FormatVariables 

Source
pub trait FormatVariables {
    // Required method
    fn format_value(&self, variable: FormatVariable) -> Option<String>;

    // Provided methods
    fn format_value_by_name(&self, name: &str) -> Option<String> { ... }
    fn format_name_exists(
        &self,
        _scope: Option<char>,
        _name: &str,
    ) -> Option<bool> { ... }
    fn format_loop(
        &self,
        _scope: char,
        _body: &str,
        _count_only: bool,
    ) -> Option<String> { ... }
}
Expand description

A source of values for supported format variables.

Required Methods§

Source

fn format_value(&self, variable: FormatVariable) -> Option<String>

Resolves a supported format variable to its rendered value.

Provided Methods§

Source

fn format_value_by_name(&self, name: &str) -> Option<String>

Resolves an arbitrary string-keyed variable name.

The default implementation delegates to the enum-based lookup. Runtime implementors can override this to support @user options and the full dynamic variable inventory.

Source

fn format_name_exists(&self, _scope: Option<char>, _name: &str) -> Option<bool>

Checks whether a window or session name exists for the N: modifier.

scope is None or Some('w') for windows and Some('s') for sessions.

Source

fn format_loop( &self, _scope: char, _body: &str, _count_only: bool, ) -> Option<String>

Expands runtime loop modifiers such as S, W, and P.

The default implementation leaves these modifiers unsupported.

Implementors§