Skip to main content

Module codebehind

Module codebehind 

Source
Expand description

Event handlers in a screen’s code-behind — what double-clicking a button in Visual Studio’s designer does: foo.yui’s on_click="play" gets an events::PLAY => play(), arm in the match over click(event) in foo.rs and an empty fn play(), and the editor opens there. An existing arm is just navigated to. A missing foo.rs is created with the usual skeleton (ui_include!, on_event, register).

Structs§

HandlerLocation
Where the editor should go.

Functions§

add_handler
Adds (or finds) the handler for event in src; None when there’s no event match to add an arm to. Returns the new text and the 1-based line/column of the handler’s body (or the existing arm).
code_behind_path
foo.yui → foo.rs beside it.
const_name
The events:: constant for an event name (yog-cli’s const_name).
ensure_handler
Makes sure yui’s code-behind handles event, writing the file when needed; where to put the caret.
handler_name
A Rust fn name for an event: play, mymod:btn-play → mymod_btn_play.