You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/05/27 16:59:05 UTC

[GitHub] [arrow-rs] ritchie46 commented on pull request #353: Add append_slice for GenericStringBuilder

ritchie46 commented on pull request #353:
URL: https://github.com/apache/arrow-rs/pull/353#issuecomment-849791863


   This is `unsafe` without an `unsafe` keyword. Rust assumes valid utf8 for all `str` and `String` values, consequently arrow assumes this as well.
   
   If you want to create a `&str` from a slice without checking validity, you should use [https://doc.rust-lang.org/std/str/fn.from_utf8_unchecked.html](https://doc.rust-lang.org/std/str/fn.from_utf8_unchecked.html) which requires unsafe code.
   
   That `&str` can then be used in `GenericStringBuilder::append`. I don't think you should add an `unsafe` API for something that's already in the std library.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org