Skip to content

Feature: unsafe push_unchecked #58

@trueb2

Description

@trueb2

I have a µcontroller that suffers with the push's including a branch on the len check (no branch predictor). I would like to reserve sufficient space, then push unchecked to avoid the overhead. I could similarly accomplish my goals with a spare_capacity_mut interface similar to Vec, but that provides slightly different internal data structure control rather than pushing initialized values through a more normal interface.

An Extend interface could benefit from this as well because it uses push internally. The Extend impl change would not resolve my purpose because it would require the overhead of managing state within the Iterator instance, so a pub push_unchecked would be preferred for me.

Would you be open to a PR with an unsafe push_unchecked impl?

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