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

vigna / sux-rs / 24195165729

09 Apr 2026 02:17PM UTC coverage: 70.88% (-0.1%) from 71.015%
24195165729

push

github

vigna
Removed slow tests from testing

7867 of 11099 relevant lines covered (70.88%)

15127499.01 hits per line

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

0.0
/src/cli.rs
1
/*
2
 * SPDX-FileCopyrightText: 2026 Sebastiano Vigna
3
 *
4
 * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
5
 */
6

7
//! Shared CLI types for the `vfunc` and `lcp_mmphf` binaries.
8

9
use std::fmt::Display;
10

11
use crate::bits::BitFieldVec;
12
use crate::func::VBuilder;
13
use crate::func::shard_edge::ShardEdge;
14

15
/// Hash types for signed functions.​
16
#[derive(clap::ValueEnum, Clone, Debug)]
17
pub enum HashTypes {
18
    U8,
19
    U16,
20
    U32,
21
    U64,
22
}
23

24
impl Display for HashTypes {
25
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
×
26
        match self {
×
27
            HashTypes::U8 => write!(f, "u8"),
×
28
            HashTypes::U16 => write!(f, "u16"),
×
29
            HashTypes::U32 => write!(f, "u32"),
×
30
            HashTypes::U64 => write!(f, "u64"),
×
31
        }
32
    }
33
}
34

35
/// VBuilder options shared by all function-building CLIs.​
36
#[derive(clap::Args, Debug)]
37
pub struct BuilderArgs {
38
    /// Use this number of threads.​
39
    #[arg(short, long)]
40
    pub threads: Option<usize>,
41
    /// Use disk-based buckets to reduce memory usage at construction time.​
42
    #[arg(short, long)]
43
    pub offline: bool,
44
    /// Sort shards and check for duplicate signatures.​
45
    #[arg(short, long)]
46
    pub check_dups: bool,
47
    /// A 64-bit seed for the pseudorandom number generator.​
48
    #[arg(long)]
49
    pub seed: Option<u64>,
50
    /// The target relative space overhead due to sharding.​
51
    #[arg(long, default_value_t = 0.001)]
52
    pub eps: f64,
53
    /// Always use the low-mem peel-by-signature algorithm (slightly slower).​
54
    #[arg(long)]
55
    pub low_mem: bool,
56
    /// Always use the high-mem peel-by-signature algorithm (slightly faster).​
57
    #[arg(long, conflicts_with = "low_mem")]
58
    pub high_mem: bool,
59
}
60

61
impl BuilderArgs {
62
    /// Applies these options to a [`VBuilder`].
63
    pub fn configure<D: Send + Sync, S, E: ShardEdge<S, 3>>(
×
64
        &self,
65
        builder: VBuilder<D, S, E>,
66
    ) -> VBuilder<D, S, E> {
67
        let mut builder = builder
×
68
            .offline(self.offline)
×
69
            .check_dups(self.check_dups)
×
70
            .eps(self.eps);
×
71
        if let Some(seed) = self.seed {
×
72
            builder = builder.seed(seed);
×
73
        }
74
        if let Some(threads) = self.threads {
×
75
            builder = builder.max_num_threads(threads);
×
76
        }
77
        if self.low_mem {
×
78
            builder = builder.low_mem(true);
×
79
        }
80
        if self.high_mem {
×
81
            builder = builder.low_mem(false);
×
82
        }
83
        builder
×
84
    }
85

86
    /// Creates and configures a default [`VBuilder`] with [`BitFieldVec`]
87
    /// storage.
88
    pub fn to_builder(&self) -> VBuilder<BitFieldVec<Box<[usize]>>> {
×
89
        self.configure(VBuilder::default())
×
90
    }
91
}
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

© 2026 Coveralls, Inc