Parse repo & author to strings
This commit is contained in:
parent
939525d5c3
commit
a3c115a035
1 changed files with 7 additions and 4 deletions
11
src/lib.rs
11
src/lib.rs
|
@ -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> {
|
||||||
|
|
Loading…
Reference in a new issue