Resolve init file write error
All checks were successful
Basic Cargo Checks / docker-build (push) Successful in 29s
Basic Cargo Checks / docker-check (push) Successful in 2m30s

Was originally trying to create a text file in the /dev path, which is
not possible. Have now used string parsing to resolve this issue.
This commit is contained in:
Blizzard Finnegan 2023-06-09 10:46:00 -04:00
parent 7f3e4326ea
commit 980a8432e6
Signed by: blizzardfinnegan
GPG key ID: 61C1E13067E0018E
2 changed files with 14 additions and 2 deletions

2
Cargo.lock generated
View file

@ -639,7 +639,7 @@ dependencies = [
[[package]]
name = "seymour_poc_rust"
version = "2.0.1"
version = "2.1.0"
dependencies = [
"chrono",
"clap",

View file

@ -78,8 +78,20 @@ pub struct TTY{
}
impl std::fmt::Debug for TTY{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result{
let absolute_location = self.tty.name();
let relative_location:String;
match absolute_location{
Some(abs_location_string) => {
let sectioned_abs_location = abs_location_string.rsplit_once('/');
match sectioned_abs_location{
Some((_,serial_device_name)) => relative_location = serial_device_name.to_string(),
None => relative_location = "unknown".to_string()
}
},
None => relative_location = "unknown".to_string()
};
f.debug_struct("TTY")
.field("Serial port name",&self.tty.name().unwrap_or("Unknown".to_string()))
.field("Serial port name",&relative_location)
.finish()
}
}