diff --git a/services/gam/src/modal.rs b/services/gam/src/modal.rs index 56c01cc8a..a2649fff1 100644 --- a/services/gam/src/modal.rs +++ b/services/gam/src/modal.rs @@ -48,7 +48,7 @@ pub trait ActionApi { fn close(&mut self) {} fn is_password(&self) -> bool { false } /// navigation is one of '∴' | '←' | '→' | '↑' | '↓' - fn key_action(&mut self, _key: char) -> (Option>, bool) {(None, true)} + fn key_action(&mut self, _key: char) -> (Option, bool) {(None, true)} fn set_action_opcode(&mut self, _op: u32) {} } diff --git a/services/gam/src/modal/checkboxes.rs b/services/gam/src/modal/checkboxes.rs index 0ec452616..57799f0ac 100644 --- a/services/gam/src/modal/checkboxes.rs +++ b/services/gam/src/modal/checkboxes.rs @@ -132,7 +132,7 @@ impl ActionApi for CheckBoxes { DrawStyle::new(PixelColor::Dark, PixelColor::Dark, 1)) ).expect("couldn't draw entry line"); } - fn key_action(&mut self, k: char) -> (Option>, bool) { + fn key_action(&mut self, k: char) -> (Option, bool) { log::trace!("key_action: {}", k); match k { '←' | '→' => { diff --git a/services/gam/src/modal/consoleinput.rs b/services/gam/src/modal/consoleinput.rs index a00085be5..b2db4df1a 100644 --- a/services/gam/src/modal/consoleinput.rs +++ b/services/gam/src/modal/consoleinput.rs @@ -24,7 +24,7 @@ impl ActionApi for ConsoleInput { fn redraw(&self, _at_height: i16, _modal: &Modal) { // has nothing } - fn key_action(&mut self, k: char) -> (Option>, bool) { + fn key_action(&mut self, k: char) -> (Option, bool) { log::trace!("key_action: {}", k); match k { '\u{0}' => { diff --git a/services/gam/src/modal/notification.rs b/services/gam/src/modal/notification.rs index 06b50613a..3724c600b 100644 --- a/services/gam/src/modal/notification.rs +++ b/services/gam/src/modal/notification.rs @@ -88,7 +88,7 @@ impl ActionApi for Notification { ).expect("couldn't draw entry line"); } } - fn key_action(&mut self, k: char) -> (Option>, bool) { + fn key_action(&mut self, k: char) -> (Option, bool) { log::trace!("key_action: {}", k); match k { '\u{0}' => { diff --git a/services/gam/src/modal/radiobuttons.rs b/services/gam/src/modal/radiobuttons.rs index 85d5c875f..b4b68c0d0 100644 --- a/services/gam/src/modal/radiobuttons.rs +++ b/services/gam/src/modal/radiobuttons.rs @@ -146,7 +146,7 @@ impl ActionApi for RadioButtons { DrawStyle::new(color, color, 1)) ).expect("couldn't draw entry line"); } - fn key_action(&mut self, k: char) -> (Option>, bool) { + fn key_action(&mut self, k: char) -> (Option, bool) { log::trace!("key_action: {}", k); match k { '←' | '→' => { diff --git a/services/gam/src/modal/slider.rs b/services/gam/src/modal/slider.rs index b6318156f..ad22fb55a 100644 --- a/services/gam/src/modal/slider.rs +++ b/services/gam/src/modal/slider.rs @@ -161,7 +161,7 @@ impl ActionApi for Slider { ); modal.gam.draw_rectangle(modal.canvas, inner_rect).expect("couldn't draw inner rectangle"); } - fn key_action(&mut self, k: char) -> (Option>, bool) { + fn key_action(&mut self, k: char) -> (Option, bool) { log::trace!("key_action: {}", k); if !self.is_progressbar { match k { diff --git a/services/gam/src/modal/textentry.rs b/services/gam/src/modal/textentry.rs index 7a8a19cd2..c8c2cd707 100644 --- a/services/gam/src/modal/textentry.rs +++ b/services/gam/src/modal/textentry.rs @@ -7,6 +7,8 @@ use num_traits::*; use core::fmt::Write; +pub type ValidatorErr = xous_ipc::String::<256>; + #[derive(Debug, Copy, Clone, num_derive::FromPrimitive, num_derive::ToPrimitive)] pub enum TextEntryVisibility { /// text is fully visible @@ -25,7 +27,7 @@ pub struct TextEntry { pub action_payload: TextEntryPayload, // validator borrows the text entry payload, and returns an error message if something didn't go well. // validator takes as ragument the current action_payload, and the current action_opcode - pub validator: Option Option> >, + pub validator: Option Option >, } impl ActionApi for TextEntry { fn set_action_opcode(&mut self, op: u32) {self.action_opcode = op} @@ -180,7 +182,7 @@ impl ActionApi for TextEntry { DrawStyle::new(color, color, 1)) ).expect("couldn't draw entry line"); } - fn key_action(&mut self, k: char) -> (Option>, bool) { + fn key_action(&mut self, k: char) -> (Option, bool) { log::trace!("key_action: {}", k); match k { '←' => { diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index 062fd5179..7699238c5 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -3,7 +3,7 @@ pub mod api; use api::*; -use gam::TextEntryPayload; +use gam::*; use xous::{CID, SID, send_message, Message}; use num_traits::{ToPrimitive, FromPrimitive}; use xous_ipc::Buffer; @@ -23,7 +23,7 @@ impl Modals { pub fn get_text_input(&self, prompt: &str, - maybe_validator: Option Option> >, + maybe_validator: Option Option >, maybe_validator_op: Option, ) -> Result { let validator = if let Some(validator) = maybe_validator { diff --git a/services/rtc/src/main.rs b/services/rtc/src/main.rs index d11ec467b..53aaf3722 100644 --- a/services/rtc/src/main.rs +++ b/services/rtc/src/main.rs @@ -522,42 +522,42 @@ mod implementation { } } -fn rtc_ux_validator(input: TextEntryPayload, opcode: u32) -> Option> { +fn rtc_ux_validator(input: TextEntryPayload, opcode: u32) -> Option { let text_str = input.as_str(); let input_int = match text_str.parse::() { Ok(input_int) => input_int, - _ => return Some(xous_ipc::String::<512>::from_str(t!("rtc.integer_err", xous::LANG))), + _ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", xous::LANG))), }; log::trace!("validating input {}, parsed as {} for opcode {}", text_str, input_int, opcode); match FromPrimitive::from_u32(opcode) { Some(Opcode::UxMonth) => { if input_int < 1 || input_int > 12 { - return Some(xous_ipc::String::<512>::from_str(t!("rtc.range_err", xous::LANG))) + return Some(ValidatorErr::from_str(t!("rtc.range_err", xous::LANG))) } } Some(Opcode::UxDay) => { if input_int < 1 || input_int > 31 { - return Some(xous_ipc::String::<512>::from_str(t!("rtc.range_err", xous::LANG))) + return Some(ValidatorErr::from_str(t!("rtc.range_err", xous::LANG))) } } Some(Opcode::UxYear) => { if input_int > 99 { - return Some(xous_ipc::String::<512>::from_str(t!("rtc.range_err", xous::LANG))) + return Some(ValidatorErr::from_str(t!("rtc.range_err", xous::LANG))) } } Some(Opcode::UxHour) => { if input_int > 23 { - return Some(xous_ipc::String::<512>::from_str(t!("rtc.range_err", xous::LANG))) + return Some(ValidatorErr::from_str(t!("rtc.range_err", xous::LANG))) } } Some(Opcode::UxMinute) => { if input_int > 59 { - return Some(xous_ipc::String::<512>::from_str(t!("rtc.range_err", xous::LANG))) + return Some(ValidatorErr::from_str(t!("rtc.range_err", xous::LANG))) } } Some(Opcode::UxSeconds) => { if input_int > 59 { - return Some(xous_ipc::String::<512>::from_str(t!("rtc.range_err", xous::LANG))) + return Some(ValidatorErr::from_str(t!("rtc.range_err", xous::LANG))) } } _ => {