use std; pub struct Modem { is_connected: bool, } #[derive(Debug, Clone)] pub struct ModemConnectionError; impl std::fmt::Display for ModemConnectionError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "gprs connection error") } } type ModemConnection = Result; impl Modem { pub fn new() -> Self { Self { is_connected: false, } } pub fn connect_to_gprs_ap(mut self, apn: &str, username: &str, password: &str)-> ModemConnection { // TODO: set AT command for connecting to gprs self.is_connected = true; Ok(self) } }