Skip to main content

actions

Macro actions 

Source
macro_rules! actions {
    ($namespace:path, [ $( $(#[$attr:meta])* $name:ident),* $(,)? ]) => { ... };
    ([ $( $(#[$attr:meta])* $name:ident),* $(,)? ]) => { ... };
}
Expand description

Defines and registers unit structs that can be used as actions. For more complex data types, derive Action.

For example:

use open_gpui::actions;
actions!(editor, [MoveUp, MoveDown, MoveLeft, MoveRight, Newline]);

This will create actions with names like editor::MoveUp, editor::MoveDown, etc.

The namespace argument editor can also be omitted for application-local actions. Public actions should use an explicit namespace so keymaps can refer to them unambiguously.