[−][src]Macro wlroots::with_handles
A convenience macro designed for use with Handle types.
This allows you to avoid the rightward drift of death that is often found with heavily nested callback systems.
Any HandleResult
s are flattened and the first one encountered is immediately
returned before any of the $body
code is executed.
Order of evaluation is from left to right. It is possible to refer to the previous
result, as commonly found in Lisp's let*
macro.
An example of simple use:
ⓘThis example is not tested
with_handles!([(compositor: {compositor}), (output: {&mut result.output_handle})] => { ... })
A more complex use:
ⓘThis example is not tested
with_handles!([(shell: {shell_handle}), // Notice how we use the previous result to get the surface. (surface: {shell.surface_handle})] => { ... })