Skip to content

Commit

Permalink
impl check result response
Browse files Browse the repository at this point in the history
  • Loading branch information
ava57r committed Apr 13, 2018
1 parent 716ad2b commit 71e5026
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {
};

match send_one_value(&command) {
Ok(response) => println!("{:?}", response),
Ok(response) => println!("{:?} is success {} ", response, response.success()),
Err(e) => println!("Error {}", e),
}
}
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,10 @@ pub struct Response {
response: String,
info: String,
}

impl Response {
/// Verifies successful if there was a request
pub fn success(&self) -> bool {
self.response == "success"
}
}

0 comments on commit 71e5026

Please sign in to comment.