string-box 1.1.1

Create Rust string from UTF-8 string, byte string or wide string.
Documentation
  • Coverage
  • 0%
    0 out of 10 items documented0 out of 0 items with examples
  • Size
  • Source code size: 9.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 797.54 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • syrel

StringBox

Crates.io MIT licensed

Allows developers to create Rust String from byte-string, utf-8 encoded C-string or wide-string.

Examples

From a not null-terminated byte-string:

let byte_string = vec![104u8, 101, 108, 108, 111];
let string = StringBox::from_byte_string(byte_string);
assert_eq!(string.to_string(), String::from("hello"));

From a null-terminated utf-8 string:

let utf8_string = vec![104u8, 101, 108, 108, 111, 0];
let string = StringBox::from_utf8_string(utf8_string.as_slice());
assert_eq!(string.to_string(), String::from("hello"));