kas-gui / kas

Another GUI toolkit
Apache License 2.0
892 stars 27 forks source link

Restrict possible method calls on layout objects #439

Closed dhardy closed 5 months ago

dhardy commented 5 months ago

438 allowed layout macros to parse any method call on a layout object, translated verbatim to a method call on the generated Visitor object. This is potentially undesirable (already .pack(hints) is translated to .pack(hints, storage) for some generated storage object and .map_all() adjusts macro expansion instead of translating to a method call). This PR adds direct support for parsing .align(hints) and removes support for translating method calls verbatim.

Note: all these method calls emulate methods available on widget objects. rust-analyzer appears to link .pack and .align to the emulated method of AdaptWidget instead of the actually-used method on Visitor (possibly a bug, but it's acceptable here). The .map_all() method is not linked to anything (not surprising since the macro does not expand it as a method call). Unfortunately rust-analyzer is not able to suggest any of these available methods.