Skip to main content

try_load_theme_from_content

Function try_load_theme_from_content 

Source
pub fn try_load_theme_from_content(content: &str) -> Result<Theme, String>
Expand description

What: Parse theme configuration text into a Theme without touching disk.

Inputs:

  • content: Full theme configuration text (key = value color pairs).

Output:

  • Ok(Theme) when all required colors are present and valid.
  • Err(String) containing newline-separated diagnostics when parsing fails.

Details:

  • In-memory twin of [try_load_theme_with_diagnostics]; used by the integrated config editor to validate proposed content before committing a theme write, so an invalid edit never reaches theme.conf.

§Errors

  • Returns newline-separated diagnostics when required keys are missing, duplicated, or colors fail to parse.

§Panics

  • Never in practice: the internal expect runs only after the missing-required-keys check guarantees every canonical key is present.