duat_core::forms

Function set

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

Sets the Form by the name of name

This will create a new form or replace one that already exists, and you can either set it to a Form directly, or reference another form by its name:

// Creates a regular form
forms::set("MyRegularForm", Form::red());
// Creates a form that references the first
forms::set("MyRefForm", "MyRegularForm");
// Sets both "MyRegularForm" and "MyRefForm" to blue
forms::set("MyRegularForm", Form::blue());

If you are creating a plugin, or another kind of tool for others using Duat, use forms::set_weak instead of this function.