Skip to content

Feature request create a vec macro #344

Open
@seanybaggins

Description

@seanybaggins

I was wondering if you could make a vec macro that is similar to the one in the standard lib.

Activity

rjsberry

rjsberry commented on Feb 27, 2023

@rjsberry
Contributor

If you're looking to make vector initialization from arrays a one-liner and avoid extra copies, one soluton could be if we implement From<[T; M]> for Vec<T, N> where N >= M.

let v: Vec<u8, 8> = [0, 1, 2, 3].into(); // capacity=8, length=4
linked a pull request that will close this issue on Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @newAM@rjsberry@seanybaggins

      Issue actions

        Feature request create a vec macro · Issue #344 · rust-embedded/heapless