Skip to content

Commit 2bb582a

Browse files
committed
More Rustdoc.
1 parent 1e4a20e commit 2bb582a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ pub enum DecodeError {
161161
InvalidAm { am: u64 },
162162
}
163163

164+
/// Information about the decoding of a field (or the entire ESR value).
164165
#[derive(Clone, Debug, Eq, PartialEq)]
165166
pub struct Decoded {
167+
/// A description explaining the field value, if available.
166168
pub description: Option<String>,
169+
/// Any sub-fields.
167170
pub fields: Vec<FieldInfo>,
168171
}
169172

@@ -178,6 +181,7 @@ fn decode_iss_res0(iss: u64) -> Result<Decoded, DecodeError> {
178181
}
179182
}
180183

184+
/// Decodes the given Exception Syndrome Register value, or returns an error if it is not valid.
181185
pub fn decode(esr: u64) -> Result<Decoded, DecodeError> {
182186
let res0 = FieldInfo::get(esr, "RES0", 37, 64).check_res0()?;
183187
let iss2 = FieldInfo::get(esr, "ISS2", 32, 37);
@@ -304,7 +308,10 @@ mod tests {
304308
}
305309
}
306310

307-
/// Parse a decimal or hexadecimal number.
311+
/// Parses a decimal or hexadecimal number from a string.
312+
///
313+
/// If the string starts with `"0x"` then it will be parsed as hexadecimal, otherwise it will be
314+
/// assumed to be decimal.
308315
pub fn parse_number(s: &str) -> Result<u64, ParseIntError> {
309316
if let Some(hex) = s.strip_prefix("0x") {
310317
u64::from_str_radix(hex, 16)

0 commit comments

Comments
 (0)