Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add str pointer methods #85816

Closed
wants to merge 4 commits into from

Commits on Sep 3, 2021

  1. Add ptr::{str_from_raw_parts, str_from_raw_parts_mut} functions

    The functions are under feature gate `str_from_raw_parts` and are similar to
    `slice_from_raw_parts`, `slice_from_raw_parts_mut`.
    WaffleLapkin committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    d2e78d8 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2021

  1. Add const_str_ptr and mut_str_ptr lang items

    These items allow to make inherent impls for `*const str` and `*mut str`.
    WaffleLapkin committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    ab96836 View commit details
    Browse the repository at this point in the history
  2. Add raw str methods

    This patch adds the following methods to `*const str` and `*mut str`:
    - `len`
    - `as_ptr` (`as_mut_ptr`)
    - `get_unchecked` (`get_unchecked_mut`)
    
    Similar methods have already existed for raw slices.
    WaffleLapkin committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    c482f97 View commit details
    Browse the repository at this point in the history
  3. Add nonnull raw str methods

    This patch adds the following methods to `NonNull<str>`:
    - `str_from_raw_parts`
    - `len`
    - `as_non_null_ptr`
    - `as_mut_ptr`
    - `get_unchecked_mut`
    
    Similar methods have already existed for raw slices, raw strings and nonnull
    raw strings.
    WaffleLapkin committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    3ebb712 View commit details
    Browse the repository at this point in the history