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

Need unsafe fn core::str::from_cstr_len #1666

Closed
brson opened this issue Jan 25, 2012 · 0 comments
Closed

Need unsafe fn core::str::from_cstr_len #1666

brson opened this issue Jan 25, 2012 · 0 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Jan 25, 2012

We have a function str::from_cstr but it assumes that C string is null-terminated. The only way I see to build a string from a non-null-terminated buffer is using str::from_bytes(vec::from_buf()) which requires an extra copy of the string.

@brson brson closed this as completed in 6408d54 Feb 12, 2012
brson added a commit that referenced this issue Feb 12, 2012
Implement core::str::from_cstr_len with a test, close issue #1666
killerswan pushed a commit to killerswan/rust that referenced this issue Feb 12, 2012
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

1 participant