Crates.io | threadid |
lib.rs | threadid |
version | 0.1.0 |
created_at | 2025-08-12 00:27:08.11759+00 |
updated_at | 2025-08-30 03:19:46.041042+00 |
description | Fast and flexible thread identifiers |
homepage | |
repository | https://github.com/Techcable/threadid.rs |
max_upload_size | |
id | 1791226 |
size | 63,880 |
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.
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.
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.