#[repr(u8)]pub enum Precision {
Show 24 variants
P1 = 0,
P2 = 1,
P3 = 2,
P4 = 3,
P5 = 4,
P6 = 5,
P7 = 6,
P8 = 7,
P9 = 8,
P10 = 9,
P11 = 10,
P12 = 11,
P13 = 12,
P14 = 13,
P15 = 14,
P16 = 15,
P17 = 16,
P18 = 17,
P19 = 18,
P20 = 19,
P21 = 20,
P22 = 21,
P23 = 22,
P24 = 23,
}
Expand description
The precision of the BJKST data structure, in bits.
A Bjkst
with precision p
can store up to 2^p
elements
before shrinking. The internal array will be at most twice as large.
Default precision is 16 bits, that is, 65,536 elements.
Variants§
P1 = 0
1-bit precision.
P2 = 1
2-bit precision.
P3 = 2
3-bit precision.
P4 = 3
4-bit precision.
P5 = 4
5-bit precision.
P6 = 5
6-bit precision.
P7 = 6
7-bit precision.
P8 = 7
8-bit precision.
P9 = 8
9-bit precision.
P10 = 9
10-bit precision.
P11 = 10
11-bit precision.
P12 = 11
12-bit precision.
P13 = 12
13-bit precision.
P14 = 13
14-bit precision.
P15 = 14
15-bit precision.
P16 = 15
16-bit precision (default).
P17 = 16
17-bit precision.
P18 = 17
18-bit precision.
P19 = 18
19-bit precision.
P20 = 19
20-bit precision.
P21 = 20
21-bit precision.
P22 = 21
22-bit precision.
P23 = 22
23-bit precision.
P24 = 23
24-bit precision.
Implementations§
Source§impl Precision
impl Precision
Sourcepub const fn new(value: u8) -> Option<Precision>
pub const fn new(value: u8) -> Option<Precision>
Creates a new Precision
if the given value is valid.
Sourcepub fn in_range(&self, value: u8) -> bool
pub fn in_range(&self, value: u8) -> bool
Checks whether the given value is in the range of available precisions.
Sourcepub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseError>
pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseError>
Converts a string slice in a given base to a precision.
The string is expected to be an optional +
sign followed by digits.
Leading and trailing whitespace represent an error.
Digits are a subset of these characters, depending on radix
:
0-9
a-z
A-Z
§Panics
Panics if radix
is not in the range from 2 to 36.
§Examples
use uniq_ch::Precision;
assert_eq!(Precision::from_str_radix("10", 10), Ok(Precision::P10));