duat_core::forms

Function set_weak

Source
pub fn set_weak(name: impl ToString, form: impl FormFmt) -> FormId
Expand description

Sets a form, “weakly”

The difference between this function and forms::set is that this function will only trigger if the form didn’t already exist.

This is useful for plugins, since it prioritizes the user’s preferences, no matter in what order this function and forms::set are called:

use duat_core::forms::{self, Form};
// Creates a form
forms::set_weak("WeakForm", Form::blue().on_white());
// Creates a form "strongly"
forms::set("StrongForm", Form::new().bold());
// Does nothing
forms::set_weak("StrongForm", "Default");