tinyvec_string 0.1.0

tinyvec based string types
docs.rs failed to build tinyvec_string-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: tinyvec_string-0.3.2

crates.io docs.rs

tinyvec_string

tinyvec based string types.

See the docs.rs documentation

tinyvec_string provides two string types:

  • ArrayString, a string backed by a fixed-size array on the stack, using ArrayVec
  • TinyString, a string backed by either a fixed-size array on the stack or a Vec on the heap, using TinyVec

Features

Like tinyvec, tinyvec_string is no_std by default.

ArrayString has no dependencies (other than tinyvec and core).

TinyString requires the the alloc cargo feature to be enabled because it has a dependency on alloc:

[dependencies]
tinyvec_string = { version = "0.1.0", features = ["alloc"] }

Error types implement std::error::Error when the std feature is enabled.

Safety

This crate strives to be as safe as possible. Almost all internal unsafe code is copied verbatim from std's String implementation for maximum reliability and performance. That said, this unsafe code is relying on tinyvec, which is 100% safe. The implication of this is that if you implement Array, a safe trait to implement, on your own type incorrectly (not always returning the same slice), then you could have memory safety problems. Using this crate with the primitive array types ([u8; N]) will cause no problems.

Contributing

Feel free to open an issue if you have a problem, or open a pull request if you have a solution. Also feel free to reach me on Discord on the Rust Community Server @ThatsNoMoon#1075.

License

tinyvec_string is dual-licensed under Apache-2.0 and MIT. Large sections of code, documentation, and tests were copied verbatim or copied and modified from rust-lang/rust; copyright for such content belongs to the original author.