From a3c115a035501b31d7a0df313c0bcdca75506ecd Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Sat, 2 Oct 2021 15:49:40 -0500 Subject: [PATCH] Parse repo & author to strings --- src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 41d9687..ab8baf5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,18 +15,21 @@ pub enum ErrorKind { #[error(transparent)] Io(#[from] std::io::Error), + + #[error(transparent)] + Utf8(#[from] std::string::FromUtf8Error), } pub async fn identity(port: &mut SerialStream) -> Result, Error> { get_prop(port, b"ident").await } -pub async fn author(port: &mut SerialStream) -> Result, Error> { - get_prop(port, b"author").await +pub async fn author(port: &mut SerialStream) -> Result { + Ok(String::from_utf8(get_prop(port, b"author").await?)?) } -pub async fn repo(port: &mut SerialStream) -> Result, Error> { - get_prop(port, b"repo").await +pub async fn repo(port: &mut SerialStream) -> Result { + Ok(String::from_utf8(get_prop(port, b"repo").await?)?) } pub async fn reset(port: &mut SerialStream) -> Result<(), Error> {