Skip to content

Can we pass message to user's Message Handler by value? #217

@7sDream

Description

@7sDream

I noticed that the Handler trait currently accepts Message by reference. However, since the framework no longer uses this Message internally, it would seem better to transfer ownership directly to the Handler, which would help reduce memeory allocate operations within the Handler(e.g. clone whole message/some string field).

I know it's a public Trait definition, modifying it would be a breaking change. However, I believe pass by value here is more Rust idiomatic, so I still put forward this as a suggestion. Feel free to close this if it's not feasible. 😉

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