Skip to content

Make str::as_buf less error prone. #3371

Closed
@brson

Description

@brson

as_buf passes to the callback the length of the string + 1 for the null character. Now that it as_buf also accepts slices this results in some very confusing behavior (#3365).

I suggest we remove the len parameter completely. Users that care about the length should capture it and not assume anything about null termination (as_c_str is for null termination).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions