Skip to content

wrap_* macros are not good DX #297

@amrbashir

Description

@amrbashir

There is a few issues with the current wrap_* macros that ruin DX and actively makes me want to punch my monitor:

  1. Can't be formatted with cargo fmt or rustfmt

  2. No IDE IntelliSense support for trait methods

    wrap_keyboard_handler! {
        struct DemoKeyboardHandler {}
    
        impl KeyboardHandler {
          // press ctrl+space here, doesn't show any methods
        }
    }
  3. Need to know class hierarchy and order of implementation, otherwise, you get "Unexpected token in input":

    wrap_window_delegate! {
        struct DemoWindowDelegate {}
    
        impl ViewDelegate {}
    
        impl PanelDelegate {}
    
        impl WindowDelegate {}
    }

    if you impl PanelDelegate before ViewDelegate, you get error.
    if you forget to impl ViewDelegate you get error.

    More than often, I have to open wrap_* macro definition to know what I am missing or the shape of a method I want to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions