jonhoo / Arccstr
Licence: other
Thread-safe, reference-counted null-terminated immutable Rust strings.
Stars: ✭ 34
Programming Languages
rust
11053 projects
Labels
Projects that are alternatives of or similar to Arccstr
String
Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way.
Stars: ✭ 709 (+1985.29%)
Mutual labels: string
Libimagequant Rust
libimagequant (pngquant) bindings for the Rust language
Stars: ✭ 17 (-50%)
Mutual labels: rust-library
Simulacrum
A small library for creating mock objects in Rust.
Stars: ✭ 21 (-38.24%)
Mutual labels: rust-library
Rage
A simple, secure and modern encryption tool (and Rust library) with small explicit keys, no config options, and UNIX-style composability.
Stars: ✭ 826 (+2329.41%)
Mutual labels: rust-library
Tract
Tiny, no-nonsense, self-contained, Tensorflow and ONNX inference
Stars: ✭ 899 (+2544.12%)
Mutual labels: rust-library
Redbpf
Rust library for building and running BPF/eBPF modules
Stars: ✭ 611 (+1697.06%)
Mutual labels: rust-library
Rust Csv
A CSV parser for Rust, with Serde support.
Stars: ✭ 911 (+2579.41%)
Mutual labels: rust-library
Javascript Obfuscator
A powerful obfuscator for JavaScript and Node.js
Stars: ✭ 8,204 (+24029.41%)
Mutual labels: string
Argh
Rust derive-based argument parsing optimized for code size
Stars: ✭ 803 (+2261.76%)
Mutual labels: rust-library
Stringplus
Funny and minimal string library for C++ inspired by underscore.string
Stars: ✭ 7 (-79.41%)
Mutual labels: string
Lopdf
A Rust library for PDF document manipulation.
Stars: ✭ 720 (+2017.65%)
Mutual labels: rust-library
Php Confusable Homoglyphs
A PHP port of https://github.com/vhf/confusable_homoglyphs
Stars: ✭ 27 (-20.59%)
Mutual labels: string
Quicksilver
A simple framework for 2D games on desktop and web
Stars: ✭ 710 (+1988.24%)
Mutual labels: rust-library
Rusticsom
Rust library for Self Organising Maps (SOM).
Stars: ✭ 18 (-47.06%)
Mutual labels: rust-library
Photon
⚡ Rust/WebAssembly image processing library
Stars: ✭ 963 (+2732.35%)
Mutual labels: rust-library
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!("foobar");
// CString:
// * mostly same as String
// * space overhead is 2*usize (uses Box<[u8]> internally)
// - cannot contain internal \0 bytes
use std::ffi::CString;
let s = CString::new("foobar").unwrap();
// CStr:
// + space overhead is just the pointer (1*usize)
// - hard to construct
// - cannot contain internal \0 bytes
// - generally cannot be shared between threds (lifetime usually not 'static)
use std::ffi::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 std::sync::Arc;
let s = ArcCStr::try_from(format!("foobar")).unwrap();
// Arc<str>:
// + can be created at runtime
// + can be shared between threads
// - space overhead is 4*usize:
// - pointer to Arc
// - str length
// - weak count
// - strong count
let s: Arc<str> = Arc::from("foobar");
// Arc<CStr>:
// + can be created at runtime
// + can be shared between threads
// - space overhead is 4*usize:
// - pointer to Arc
// - CStr length
// - weak count
// - strong count
// - cannot contain internal \0 bytes
let s: Arc<CStr> = Arc::from(CStr::from_bytes_with_nul(b"foobar\0").unwrap());
// ArcCStr:
// + can be created at runtime
// + can be shared between threads
// - space overhead is 2*usize (pointer + strong count)
// - cannot contain internal \0 bytes
use arccstr::ArcCStr;
let s = ArcCStr::try_from("foobar").unwrap();
See the ArcCStr
documentation for more details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].