Skip to content

Closures should accept & for arguments #1399

Open
@Pauan

Description

@Pauan

Motivation

If a Closure accepts & by argument it can use the faster stack-allocation rather than the slower heap-allocation.

Basically, this should be possible:

let f = move |e: &Foo| { ... };
let x = Closure::wrap(Box::new(f) as Box<FnMut(&Foo)>);

Additional Context

rustwasm/gloo#30 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    closuresAdding more support for closures on the boundaryhelp wantedWe could use some help fixing this issue!more-typesAdding support for more Rust types to cross the boundary

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions