#[derive(Clone)]
pub struct Mailbox {
user: Vec<u8>,
password: Vec<u8>,
}
impl Mailbox {
pub fn new(user: &str, password: &str) -> Self {
Self {
user: user.as_bytes().to_vec(),
password: password.as_bytes().to_vec(),
}
}
pub fn authenticate(&self, user: &[u8], password: &[u8]) -> bool {
user == self.user && password == self.password
}
}