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