docs.rs failed to build arccstr-1.0.2
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.
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:
arccstr-1.3.3
arccstr
Thread-safe reference-counted null-terminated strings.
This crate provides a space efficient mechanism for storing immutable strings. The best illustration of this is to go over the alternatives:
// &str:
// - content must be known at compile time
// + can be shared between threads
// + space overhead is 2*usize (fat pointer to the string)
let s = "foobar";
// String
// + can be created at runtime
// - cannot be shared between threads (except with Clone)
// - space overhead of 3*usize (Vec capacity and len + pointer to bytes)
// - accessing string requires two pointer derefs
let s = format!;
// CString:
// * mostly same as String
// * space overhead is 2*usize (uses Box<[u8]> internally)
use CString;
let s = new.unwrap;
// CStr:
// + space overhead is just the pointer (1*usize)
// - hard to construct
// - generally cannot be shared between threds (lifetime usually not 'static)
use CStr;
let s: &CStr = &*s;
// Arc<String>:
// + can be created at runtime
// + can be shared between threads
// - space overhead is 7*usize:
// - pointer to Arc
// - weak count
// - strong count
// - pointer to String
// - String overhead (3*usize)
use Arc;
let s = from;
// ArcCStr:
// + can be created at runtime
// + can be shared between threads
// - space overhead is 2*usize (pointer + strong count)
use ArcCStr;
let s = from;
See the ArcCStr documentation for more details.
Note that this crate requires a nightly build of the compiler as it plays a lot of memory tricks.