Use anyhow
This commit is contained in:
parent
b3b7a4ea27
commit
b4089a2b7e
@ -1,4 +1,5 @@
|
||||
use anyhow::{
|
||||
bail,
|
||||
Context,
|
||||
Result,
|
||||
};
|
||||
@ -10,7 +11,7 @@ use crate::improv::{
|
||||
ImprovDataToPacket,
|
||||
};
|
||||
|
||||
pub fn find_begin_of_improv_packet(buffer: &Vec<u8>) -> Result<usize, String> {
|
||||
pub fn find_begin_of_improv_packet(buffer: &Vec<u8>) -> Result<usize> {
|
||||
let mut improv_header_char: usize = 0;
|
||||
|
||||
for (i, b) in buffer.iter().enumerate() {
|
||||
@ -29,7 +30,7 @@ pub fn find_begin_of_improv_packet(buffer: &Vec<u8>) -> Result<usize, String> {
|
||||
}
|
||||
}
|
||||
|
||||
return Err(String::from("Improv header not found"));
|
||||
bail!("Improv header not found");
|
||||
}
|
||||
|
||||
pub struct SerialInterface {
|
||||
|
Loading…
Reference in New Issue
Block a user