Use thiserror for error handling with less boilerplate

This commit is contained in:
Steve Cook
2023-02-20 09:41:28 -05:00
parent 01e4f4a126
commit f8b29f37db
135 changed files with 868 additions and 905 deletions

View File

@@ -71,7 +71,7 @@ impl BitSource {
*/
pub fn readBits(&mut self, numBits: usize) -> Result<u32> {
if !(1..=32).contains(&numBits) || numBits > self.available() {
return Err(Exceptions::illegalArgumentWith(numBits.to_string()));
return Err(Exceptions::illegal_argument_with(numBits.to_string()));
}
let mut result: u32 = 0;