• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vigna / webgraph-rs / 15211089452

23 May 2025 01:09PM UTC coverage: 50.252% (+0.07%) from 50.184%
15211089452

push

github

zommiommy
removed harmonics test

3683 of 7329 relevant lines covered (50.25%)

25295292.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/algo/src/utils/mod.rs
1
/*
2
 * SPDX-FileCopyrightText: 2024 Matteo Dell'Acqua
3
 * SPDX-FileCopyrightText: 2025 Sebastiano Vigna
4
 *
5
 * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
6
 */
7

8
//! Utilities.
9

10
mod argmax;
11
mod argmin;
12

13
/// Module containing mathematical utilities.
14
pub mod math {
15
    pub use super::argmax::*;
16
    pub use super::argmin::*;
17
}
18

19
/// Utility macro to create [`thread_pools`](`rayon::ThreadPool`).
20
///
21
/// There are two forms of this macro:
22
/// * Create a [`ThreadPool`](rayon::ThreadPool) with the default settings:
23
/// ```
24
/// # use webgraph_algo::thread_pool;
25
/// let t: rayon::ThreadPool = thread_pool![];
26
/// ```
27
/// * Create a [`ThreadPool`](rayon::ThreadPool) with a given number of threads:
28
/// ```
29
/// # use webgraph_algo::thread_pool;
30
/// let t: rayon::ThreadPool = thread_pool![7];
31
/// assert_eq!(t.current_num_threads(), 7);
32
/// ```
33
#[macro_export]
34
macro_rules! thread_pool {
35
    () => {
36
        rayon::ThreadPoolBuilder::new()
37
            .build()
38
            .expect("Cannot build a ThreadPool with default parameters")
39
    };
40
    ($num_threads:expr) => {
41
        rayon::ThreadPoolBuilder::new()
42
            .num_threads($num_threads)
43
            .build()
44
            .unwrap_or_else(|_| {
×
45
                panic!(
×
46
                    "Cannot build a ThreadPool with default parameters and {} threads",
×
47
                    $num_threads,
48
                )
49
            })
50
    };
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc