threadid

Crates.iothreadid
lib.rsthreadid
version0.1.0
created_at2025-08-12 00:27:08.11759+00
updated_at2025-08-30 03:19:46.041042+00
descriptionFast and flexible thread identifiers
homepage
repositoryhttps://github.com/Techcable/threadid.rs
max_upload_size
id1791226
size63,880
(Techcable)

documentation

README

threadid.rs

Fast and flexible thread identifiers.

The main reason this crate exists is performance. Retrieving any of these ids is 30x faster than calling std::thread::current, which calls Arc::clone internally. The three types of ids StdThreadId, UniqueThreadId, and LiveThreadId are roughly equivalent in lookup performance

The other reason this crate exists is flexibility. Using LiveThreadId will aggressively reuse thread ids to minimize the integer value of ids, making it useful as a key in a vector of live threads. Using debug::DebugThreadId is a convenience wrapper which displays std::thread::Thread::name where possible, in addition to using UniqueThreadId as a fallback when the thread is unnamed.

Similar Crates

The crate name and functionality is similar to that of the thread-id crate, which simply wraps OS primitives (pthreads/windows). Make sure you are using the right crate. They have very different APIs.

License

Licensed under either the Apache 2.0 License or MIT License at your option.

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

Commit count: 18

cargo fmt