quality_item.rs
Source contains low-bit mask syntaxRust test marker or harness
SHA-2567caa0f8322405c30d4bd8f4fdf5ac9f8f1af2a63e27b07ca39ec3c2a0c643ee5
MaleculeH(Db₂)Md₂(InPa)
Evidence
1use std::cmp;
2use std::default::Default;
3use std::fmt;
4use std::str;
5
6use self::internal::IntoQuality;
7
8/// Represents a quality used in quality values.
9///
10/// Can be created with the `q` function.
11///
12/// # Implementation notes
13///
14/// The quality value is defined as a number between 0 and 1 with three decimal
15/// places. This means there are 1001 possible values. Since floating point
16/// numbers are not exact and the s …
17:42… 16` value to store the
18/// quality internally. For performance reasons you may set quality directly to
19/// a value between 0 and 1000 e.g. `Quali …
63:26… str("; q=0"),
64 x => write!(f, "; q=0.{}", format!("{:03}", x).trim_right_matches('0')),
65 }
66 }
⋯4 lines
134:6… al.into_quality()
135}
136
137mod internal {
138 use super::Quality;
139
140 // TryFrom is probably better, but it's not stable. For now, we want to
⋯4 lines
168:23… }
169 impl Sealed for u16 {}
170 impl Sealed for f32 {}
171}
172
173#[cfg(test)]
174mod tests {
175 use super::super::encoding::*;
176 use super::*;
177
178 #[test]
179 fn test_quality_item_fmt_q_1() {
180 let x = qitem(Chunked);
⋯5 lines