#string #unix #str #string-conversion

no-std unix_str

Unix-compatible strings regardless of platform

1 stable release

1.0.0 Aug 3, 2020

#241 in No standard library

Download history 936/week @ 2024-05-22 715/week @ 2024-05-29 765/week @ 2024-06-05 878/week @ 2024-06-12 643/week @ 2024-06-19 919/week @ 2024-06-26 1178/week @ 2024-07-03 1541/week @ 2024-07-10 1431/week @ 2024-07-17 1416/week @ 2024-07-24 1512/week @ 2024-07-31 1627/week @ 2024-08-07 1771/week @ 2024-08-14 1866/week @ 2024-08-21 1573/week @ 2024-08-28 1498/week @ 2024-09-04

6,950 downloads per month
Used in 14 crates (2 directly)

MIT/Apache

58KB
1K SLoC

unix_str

Unix-compatible strings regardless of platform, including #![no_std] environents. This crate is extracted from std.

Features

  • shrink_to: implements the unstable shrink_to method;
  • unixstring_ascii: ASCII transformations, std's unstable feature;
  • toowned_clone_into: implements ToOwned::clone_into, an unstable method;
  • alloc: implements UnixString and transformations with Box, Rc and Arc;
  • std: an alias for alloc.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Strings that are compatible wuth Unix-like operating systems.

  • UnixString and UnixStr are useful when you need to with Unix strings. Conversions between UnixString, UnixStr and Rust strings work similarly to those for CString and CStr.

  • UnixString represents an owned string in Unix's preferred representation.

  • UnixStr represents a borrowed reference to a string in a format that can be passed to a Unix-lie operating system. It can be converted into a UTF-8 Rust string slice in a similar way to UnixString.

Conversions

UnixStr implements two methods, from_bytes and as_bytes. These do inexpensive conversions from and to UTF-8 byte slices.

Additionally, UnixString provides from_vec and into_vec methods that consume their arguments, and take or produce vectors of [u8].

No runtime deps

Features