tcplane 8.1.0

tcplane is a lightweight and high-performance Rust TCP server library designed to simplify network service development. It supports TCP communication, data stream management, and connection handling, focusing on providing efficient low-level network connections and data transmission capabilities, making it ideal for building modern network services.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// Gets the number of available threads for parallel processing.
///
/// This function returns the number of threads that the system can execute simultaneously,
/// which is useful for determining optimal parallelism levels.
///
/// # Returns
///
/// - `usize` - The number of available threads, or 1 if the value cannot be determined.
pub fn get_thread_count() -> usize {
    match std::thread::available_parallelism() {
        Ok(count) => count.get(),
        Err(_) => 1,
    }
}