Limit visibilities.
This commit is contained in:
parent
a3f2c930f2
commit
4959307b1f
1 changed files with 8 additions and 10 deletions
|
@ -8,9 +8,9 @@ use std::convert::TryFrom;
|
|||
#[allow(unused)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Response {
|
||||
pub(self) data: Vec<u8>,
|
||||
pub(self) sw1: u8,
|
||||
pub(self) sw2: u8,
|
||||
data: Vec<u8>,
|
||||
sw1: u8,
|
||||
sw2: u8,
|
||||
}
|
||||
|
||||
impl Response {
|
||||
|
@ -44,6 +44,11 @@ impl Response {
|
|||
pub fn status(&self) -> [u8; 2] {
|
||||
[self.sw1, self.sw2]
|
||||
}
|
||||
|
||||
/// Is the response status "ok"? [0x90, 0x00]
|
||||
pub fn is_ok(&self) -> bool {
|
||||
self.status() == [0x90, 0x00]
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TryFrom<&[u8]> for Response {
|
||||
|
@ -77,13 +82,6 @@ impl TryFrom<Vec<u8>> for Response {
|
|||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Is the response (0x90 0x00)?
|
||||
pub fn is_ok(&self) -> bool {
|
||||
self.sw1 == 0x90 && self.sw2 == 0x00
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::apdu::response::Response;
|
||||
|
|
Loading…
Reference in a new issue