urlyy commented on issue #1547:
URL: https://github.com/apache/fury/issues/1547#issuecomment-2211612233

   Hi, I've created a basic demo. Since Rust's string encoding is UTF-8, we can 
directly use the String's API to convert UTF-16 encoded data into a string. 
However, this method doesn't utilize SIMD. So, I'm wondering what else needs to 
be done on top of this. 
   ```rust
   fn main() {
       let s = "Hello";
       // initial utf-16 encoded data
       let utf16_encoded: Vec<u16> = s.encode_utf16().collect();
       // convert utf-16 to utf-8
       match String::from_utf16(&utf16_encoded) {
           Ok(string) => {
               // let utf8_data = string.into_bytes();
               println!("{}", string);
           }
           Err(e) => {
               println!("Error converting UTF-16 to UTF-8: {:?}", e);
           }
       }
   }
   ```
   I'm not familiar with high-performance computing and I've only found the 
[std::simd](https://doc.rust-lang.org/beta/std/simd/index.html) library, 
however, it is a **nightly-only experimental** API.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to