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 CStr method that accepts any slice containing a nul-terminated string #94984

Merged
merged 1 commit into from
Mar 19, 2022

Commits on Mar 18, 2022

  1. add CStr::from_bytes_until_nul

    This adds a member fn that converts a slice into a CStr; it is intended
    to be safer than from_ptr (which is unsafe and may read out of bounds),
    and more useful than from_bytes_with_nul (which requires that the caller
    already know where the nul byte is).
    
    feature gate: cstr_from_bytes_until_nul
    
    Also add an error type FromBytesUntilNulError for this fn.
    ericseppanen committed Mar 18, 2022
    Configuration menu
    Copy the full SHA
    d5fe4ca View commit details
    Browse the repository at this point in the history