Parse repo & author to strings

This commit is contained in:
Aode (lion) 2021-10-02 15:49:40 -05:00
parent 939525d5c3
commit a3c115a035

View file

@ -15,18 +15,21 @@ pub enum ErrorKind {
#[error(transparent)] #[error(transparent)]
Io(#[from] std::io::Error), Io(#[from] std::io::Error),
#[error(transparent)]
Utf8(#[from] std::string::FromUtf8Error),
} }
pub async fn identity(port: &mut SerialStream) -> Result<Vec<u8>, Error> { pub async fn identity(port: &mut SerialStream) -> Result<Vec<u8>, Error> {
get_prop(port, b"ident").await get_prop(port, b"ident").await
} }
pub async fn author(port: &mut SerialStream) -> Result<Vec<u8>, Error> { pub async fn author(port: &mut SerialStream) -> Result<String, Error> {
get_prop(port, b"author").await Ok(String::from_utf8(get_prop(port, b"author").await?)?)
} }
pub async fn repo(port: &mut SerialStream) -> Result<Vec<u8>, Error> { pub async fn repo(port: &mut SerialStream) -> Result<String, Error> {
get_prop(port, b"repo").await Ok(String::from_utf8(get_prop(port, b"repo").await?)?)
} }
pub async fn reset(port: &mut SerialStream) -> Result<(), Error> { pub async fn reset(port: &mut SerialStream) -> Result<(), Error> {