From 1fd59f0fc929385c81ce72c922ee87aedaf3a01a Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 22 Sep 2024 14:28:16 +0800 Subject: [PATCH] regex search/replace instances of xous_ipc::String to String --- services/gam/Cargo.toml | 5 +++-- services/gam/src/api.rs | 30 +++++++++++++++--------------- services/gam/src/contexts.rs | 14 +++++++------- services/gam/src/lib.rs | 16 ++++++++-------- services/gam/src/main.rs | 26 +++++++++++++------------- services/gam/src/menu.rs | 22 +++++++++++----------- services/gam/src/modal.rs | 26 +++++++++++++------------- services/gam/src/modal/slider.rs | 8 ++++---- 8 files changed, 74 insertions(+), 73 deletions(-) diff --git a/services/gam/Cargo.toml b/services/gam/Cargo.toml index 3d90aeb25..e42ebb1d3 100644 --- a/services/gam/Cargo.toml +++ b/services/gam/Cargo.toml @@ -23,8 +23,9 @@ xous-names = { package = "xous-api-names", version = "0.9.61" } num-derive = { version = "0.3.3", default-features = false } num-traits = { version = "0.2.14", default-features = false } -rkyv = { version = "0.4.3", default-features = false, features = [ - "const_generics", +rkyv = { version = "0.8.8", default-features = false, features = [ + "std", + "alloc", ] } susres = { package = "xous-api-susres", version = "0.9.59", optional = true } # used for the sleep now menu item diff --git a/services/gam/src/api.rs b/services/gam/src/api.rs index 161e5a32e..4040fa442 100644 --- a/services/gam/src/api.rs +++ b/services/gam/src/api.rs @@ -4,7 +4,7 @@ mod rkyv_enum; use graphics_server::api::Tile; use graphics_server::api::{Gid, Point}; pub use rkyv_enum::*; -use xous_ipc::String; +use String; pub(crate) const SERVER_NAME_GAM: &str = "_Graphical Abstraction Manager_"; @@ -69,10 +69,10 @@ pub struct SetAudioOpcode { pub opcode: u32, } -#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] +#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Clone)] pub struct SwitchToApp { pub token: [u32; 4], - pub app_name: String<128>, + pub app_name: String, } #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] @@ -82,15 +82,15 @@ pub enum UxType { Modal, Framebuffer, } -#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] +#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Clone)] pub struct UxRegistration { // request specification - pub app_name: String<128>, /* the putative name of our application - GAM may modify this if a spoof - * attempt is detected */ + pub app_name: String, /* the putative name of our application - GAM may modify this if a spoof + * attempt is detected */ pub ux_type: UxType, - pub predictor: Option>, /* optional specification for an IME prediction engine to use. This - * can be updated later on, or None and a default engine will be - * provided. */ + pub predictor: Option, /* optional specification for an IME prediction engine to use. This + * can be updated later on, or None and a default engine will be + * provided. */ // Callbacks: /// SID ofserver for callbacks from the GAM. Note this is a disclosure of the SID, which is normally a @@ -114,7 +114,7 @@ pub struct UxRegistration { #[cfg(feature = "unsafe-app-loading")] #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] pub struct NameRegistration { - pub name: String<128>, + pub name: String, pub auth_token: [u32; 4], } @@ -240,7 +240,7 @@ pub enum ActivationResult { } #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] pub(crate) struct GamActivation { - pub(crate) name: xous_ipc::String<128>, + pub(crate) name: String, pub(crate) result: Option, } @@ -250,9 +250,9 @@ pub(crate) struct MenuManagement { pub(crate) op: MenuMgrOp, } -#[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] +#[derive(Debug, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] pub struct MenuItem { - pub name: String<64>, + pub name: String, /// if action_conn is None, this is a NOP menu item (it just does nothing and closes the menu) pub action_conn: Option, pub action_opcode: u32, // this is ignored if action_conn is None @@ -289,9 +289,9 @@ pub struct GidRecord { pub canvas_type: CanvasType, } -#[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Default)] +#[derive(Debug, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Default)] pub struct Bip39Ipc { pub data: [u8; 32], pub data_len: u32, - pub words: [Option>; 24], + pub words: [Option; 24], } diff --git a/services/gam/src/contexts.rs b/services/gam/src/contexts.rs index 7e6f23f33..9d37754f1 100644 --- a/services/gam/src/contexts.rs +++ b/services/gam/src/contexts.rs @@ -7,7 +7,7 @@ use gam::MAIN_MENU_NAME; use graphics_server::*; use ime_plugin_api::{ImeFrontEndApi, ImefDescriptor}; use log::info; -use xous_ipc::{Buffer, String}; +use xous_ipc::Buffer; use crate::api::Opcode; use crate::*; @@ -67,7 +67,7 @@ pub(crate) struct UxContext { /// the type of the Ux defined here pub layout: UxLayout, /// what prediction engine is being used - pub predictor: Option>, + pub predictor: Option, /// a putative human-readable name given to the context. The name itself is stored in the TokenManager, /// not in this struct. Passed to the TokenManager to compute a trust level; add the app's name to /// tokens.rs EXPECTED_BOOT_CONTEXTS if you want this to succeed. @@ -166,7 +166,7 @@ impl ContextManager { canvases: &mut HashMap, registration: UxRegistration, ) -> Option<[u32; 4]> { - let maybe_token = self.tm.claim_token(registration.app_name.as_str().unwrap()); + let maybe_token = self.tm.claim_token(registration.app_name.as_str()); if let Some(token) = maybe_token { match registration.ux_type { UxType::Chat => { @@ -224,7 +224,7 @@ impl ContextManager { pred_token: None, }; - if registration.app_name.as_str().unwrap() == MAIN_MENU_NAME { + if registration.app_name.as_str() == MAIN_MENU_NAME { log::debug!("main menu found and registered!"); assert!( self.main_menu_app_token == None, @@ -262,8 +262,8 @@ impl ContextManager { }; self.contexts.insert(token, ux_context); // this check gives permissions to password boxes to render inverted text - if registration.app_name.as_str().unwrap() == gam::ROOTKEY_MODAL_NAME - || registration.app_name.as_str().unwrap() == gam::PDDB_MODAL_NAME + if registration.app_name.as_str() == gam::ROOTKEY_MODAL_NAME + || registration.app_name.as_str() == gam::PDDB_MODAL_NAME { if !self.set_context_trust_level(token, BOOT_CONTEXT_TRUSTLEVEL - 1, canvases) { log::error!("Couldn't set password box trust levels to fully trusted"); @@ -713,7 +713,7 @@ impl ContextManager { pub(crate) fn focused_app(&self) -> Option<[u32; 4]> { self.focused_context } - pub(crate) fn forward_input(&self, input: String<4000>) -> Result<(), xous::Error> { + pub(crate) fn forward_input(&self, input: String) -> Result<(), xous::Error> { if let Some(token) = self.focused_app() { if let Some(context) = self.contexts.get(&token) { if let Some(input_op) = context.gotinput_id { diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index 5c7a68a27..4c407522d 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -25,7 +25,7 @@ pub use graphics_server::api::{TextOp, TextView}; use ime_plugin_api::{ApiToken, ImefCallback}; use num_traits::*; use xous::{send_message, Message, CID}; -use xous_ipc::{Buffer, String}; +use xous_ipc::Buffer; #[doc = include_str!("../README.md")] @@ -321,7 +321,7 @@ impl Gam { } pub fn claim_token(&self, name: &str) -> Result, xous::Error> { - let tokenclaim = TokenClaim { token: None, name: String::<128>::from_str(name) }; + let tokenclaim = TokenClaim { token: None, name: String::from(name) }; let mut buf = Buffer::into_buf(tokenclaim).or(Err(xous::Error::InternalError))?; buf.lend_mut(self.conn, Opcode::ClaimToken.to_u32().unwrap()).or(Err(xous::Error::InternalError))?; let returned_claim = buf.to_original::().unwrap(); @@ -331,7 +331,7 @@ impl Gam { #[cfg(feature = "unsafe-app-loading")] pub fn register_name(&self, name: &str, auth_token: [u32; 4]) -> Result<(), xous::Error> { - let name_registration = NameRegistration { name: String::<128>::from_str(name), auth_token }; + let name_registration = NameRegistration { name: String::from(name), auth_token }; let buf = Buffer::into_buf(name_registration).or(Err(xous::Error::InternalError))?; buf.lend(self.conn, Opcode::RegisterName.to_u32().unwrap()).or(Err(xous::Error::InternalError))?; Ok(()) @@ -446,7 +446,7 @@ impl Gam { /// Failure to switch *is silent* because waiting for an activation to go through and /// confirm can cause a deadlock condition. pub fn switch_to_app(&self, app_name: &str, token: [u32; 4]) -> Result<(), xous::Error> { - let switchapp = SwitchToApp { token, app_name: String::<128>::from_str(app_name) }; + let switchapp = SwitchToApp { token, app_name: String::from(app_name) }; let buf = Buffer::into_buf(switchapp).or(Err(xous::Error::InternalError))?; buf.send(self.conn, Opcode::SwitchToApp.to_u32().unwrap()) .or(Err(xous::Error::InternalError)) @@ -454,7 +454,7 @@ impl Gam { } pub fn raise_menu(&self, menu_name_str: &str) -> Result<(), xous::Error> { - let menu_name = GamActivation { name: String::<128>::from_str(menu_name_str), result: None }; + let menu_name = GamActivation { name: String::from(menu_name_str), result: None }; let mut buf = Buffer::into_buf(menu_name).or(Err(xous::Error::InternalError))?; buf.lend_mut(self.conn, Opcode::RaiseMenu.to_u32().unwrap()) .or(Err(xous::Error::InternalError)) @@ -519,7 +519,7 @@ impl Gam { let mut ret = Vec::::new(); for word in result.words { if let Some(w) = word { - ret.push(w.as_str().unwrap().to_string()); + ret.push(w.as_str().to_string()); } } if ret.len() == 0 { Err(xous::Error::InvalidString) } else { Ok(ret) } @@ -532,7 +532,7 @@ impl Gam { } let mut ipc = Bip39Ipc::default(); for (word, slot) in bip39.iter().zip(ipc.words.iter_mut()) { - *slot = Some(xous_ipc::String::from_str(word)) + *slot = Some(String::from(word)) } let mut buf = Buffer::into_buf(ipc).or(Err(xous::Error::InternalError))?; buf.lend_mut(self.conn, Opcode::Bip39toBytes.to_u32().unwrap()) @@ -560,7 +560,7 @@ impl Gam { let mut suggestions = Vec::::new(); for word in result.words { if let Some(w) = word { - suggestions.push(w.as_str().unwrap().to_string()) + suggestions.push(w.as_str().to_string()) } } Ok(suggestions) diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index 326fb26a6..a183110ca 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -22,13 +22,13 @@ use graphics_server::*; use log::info; use num_traits::*; use xous::{msg_blocking_scalar_unpack, msg_scalar_unpack}; -use xous_ipc::{Buffer, String}; +use xous_ipc::Buffer; /// This sets the initial app focus on boot const INITIAL_APP_FOCUS: &'static str = gam::APP_NAME_SHELLCHAT; static CB_TO_MAIN_CONN: AtomicU32 = AtomicU32::new(0); -fn imef_cb(s: String<4000>) { +fn imef_cb(s: String) { if CB_TO_MAIN_CONN.load(Ordering::Relaxed) != 0 { let cb_to_main_conn = CB_TO_MAIN_CONN.load(Ordering::Relaxed); let buf = xous_ipc::Buffer::into_buf(s).or(Err(xous::Error::InternalError)).unwrap(); @@ -532,7 +532,7 @@ fn wrapped_main() -> ! { let mut buffer = unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) }; let mut tokenclaim = buffer.to_original::().unwrap(); - tokenclaim.token = context_mgr.claim_token(tokenclaim.name.as_str().unwrap()); + tokenclaim.token = context_mgr.claim_token(tokenclaim.name.as_str()); buffer.replace(tokenclaim).unwrap(); } Some(Opcode::PredictorApiToken) => { @@ -579,7 +579,7 @@ fn wrapped_main() -> ! { move || { let switchapp = SwitchToApp { token: gam_token, - app_name: String::<128>::from_str(INITIAL_APP_FOCUS), + app_name: String::from(INITIAL_APP_FOCUS), }; let buf = Buffer::into_buf(switchapp).or(Err(xous::Error::InternalError))?; buf.send(conn, Opcode::SwitchToApp.to_u32().unwrap()) @@ -597,7 +597,7 @@ fn wrapped_main() -> ! { Some(Opcode::InputLine) => { // receive the keyboard input and pass it on to the context with focus let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; - let inputline = buffer.to_original::, _>().unwrap(); + let inputline = buffer.to_original::().unwrap(); log::debug!("received input line, forwarding on... {}", inputline); match context_mgr.forward_input(inputline) { Err(e) => log::warn!("InputLine missed its target {:?}; input ignored", e), @@ -643,12 +643,12 @@ fn wrapped_main() -> ! { let switchapp = buffer.to_original::().unwrap(); log::debug!( "trying to switch to {:?} with token {:?}", - switchapp.app_name.as_str().unwrap(), + switchapp.app_name.as_str(), switchapp.token ); if let Some(new_app_token) = - context_mgr.find_app_token_by_name(switchapp.app_name.as_str().unwrap()) + context_mgr.find_app_token_by_name(switchapp.app_name.as_str()) { if new_app_token != context_mgr.focused_app().unwrap_or([0, 0, 0, 0]) { // two things: @@ -683,7 +683,7 @@ fn wrapped_main() -> ! { Ok(_) => (), Err(_) => log::warn!( "failed to switch to {}, silent error!", - switchapp.app_name.as_str().unwrap() + switchapp.app_name.as_str() ), } continue; @@ -696,7 +696,7 @@ fn wrapped_main() -> ! { Ok(_) => (), Err(_) => log::warn!( "failed to switch to {}, silent error!", - switchapp.app_name.as_str().unwrap() + switchapp.app_name.as_str() ), } } @@ -708,7 +708,7 @@ fn wrapped_main() -> ! { unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) }; let mut activation = buffer.to_original::().unwrap(); log::debug!("got request to raise context {}", activation.name); - let result = context_mgr.raise_menu(activation.name.as_str().unwrap(), &gfx, &mut canvases); + let result = context_mgr.raise_menu(activation.name.as_str(), &gfx, &mut canvases); activation.result = Some(match result { Ok(_) => ActivationResult::Success, Err(_) => ActivationResult::Failure, @@ -737,7 +737,7 @@ fn wrapped_main() -> ! { let mut phrase = Vec::::new(); for maybe_word in spec.words { if let Some(word) = maybe_word { - phrase.push(word.as_str().unwrap().to_string()); + phrase.push(word.as_str().to_string()); } } match bip39::bip39_to_bytes(&phrase) { @@ -760,7 +760,7 @@ fn wrapped_main() -> ! { match bip39::bytes_to_bip39(&data) { Ok(phrase) => { for (word, returned) in phrase.iter().zip(spec.words.iter_mut()) { - *returned = Some(xous_ipc::String::from_str(word)); + *returned = Some(String::from(word)); } } Err(_) => { @@ -778,7 +778,7 @@ fn wrapped_main() -> ! { let start = std::str::from_utf8(&spec.data[..spec.data_len as usize]).unwrap_or(""); let suggestions = bip39::suggest_bip39(start); for (word, returned) in suggestions.iter().zip(spec.words.iter_mut()) { - *returned = Some(xous_ipc::String::from_str(word)); + *returned = Some(String::from(word)); } buffer.replace(spec).unwrap(); } diff --git a/services/gam/src/menu.rs b/services/gam/src/menu.rs index e3bca6f2a..da436a56f 100644 --- a/services/gam/src/menu.rs +++ b/services/gam/src/menu.rs @@ -5,7 +5,7 @@ pub use graphics_server::*; use num_traits::*; #[cfg(feature = "tts")] use tts_frontend::TtsFrontend; -use xous_ipc::{Buffer, String}; +use xous_ipc::Buffer; use crate::api::*; use crate::Gam; @@ -45,7 +45,7 @@ impl<'a> Menu<'a> { let gam = Gam::new(&xns).expect("can't connect to GAM"); let authtoken = gam .register_ux(UxRegistration { - app_name: String::<128>::from_str(name), + app_name: String::from(name), ux_type: UxType::Menu, predictor: None, listener: sid.to_array(), @@ -117,7 +117,7 @@ impl<'a> Menu<'a> { /// Appends a menu item to the end of the current Menu pub fn add_item(&mut self, new_item: MenuItem) { - if new_item.name.as_str().unwrap() == "🔇" { + if new_item.name.as_str() == "🔇" { // suppress the addition of menu items that are not applicable for a given locale return; } @@ -146,7 +146,7 @@ impl<'a> Menu<'a> { // Attempts to insert a MenuItem at the index given. This displaces the item at that index down // by one slot. Returns false if the index is invalid. pub fn insert_item(&mut self, new_item: MenuItem, at: usize) -> bool { - if new_item.name.as_str().unwrap() == "🔇" { + if new_item.name.as_str() == "🔇" { // suppress the addition of menu items that are not applicable for a given locale return false; } @@ -184,7 +184,7 @@ impl<'a> Menu<'a> { // something) pub fn delete_item(&mut self, item: &str) -> bool { let len_before = self.items.len(); - self.items.retain(|&candidate| candidate.name.as_str().unwrap() != item); + self.items.retain(|&candidate| candidate.name.as_str() != item); // now, recompute the height let mut total_items = self.num_items(); @@ -220,11 +220,11 @@ impl<'a> Menu<'a> { if with_marker { write!(item_tv.text, "\u{25B6}").unwrap(); #[cfg(feature = "tts")] - self.tts.tts_simple(item.name.as_str().unwrap()).unwrap(); + self.tts.tts_simple(item.name.as_str()).unwrap(); } else { write!(item_tv.text, "\t").unwrap(); } - write!(item_tv.text, "{}", item.name.as_str().unwrap()).unwrap(); + write!(item_tv.text, "{}", item.name.as_str()).unwrap(); item_tv.draw_border = false; item_tv.style = crate::SYSTEM_STYLE; item_tv.margin = Point::new(0, 0); @@ -371,7 +371,7 @@ impl<'a> Menu<'a> { #[cfg(feature = "tts")] { let mut phrase = "select ".to_string(); - phrase.push_str(mi.name.as_str().unwrap()); + phrase.push_str(mi.name.as_str()); self.tts.tts_blocking(&phrase).unwrap(); } match mi.action_payload { @@ -449,7 +449,7 @@ impl MenuMatic { pub fn delete_item(&self, item_name: &str) -> bool { let mm = MenuManagement { item: MenuItem { - name: String::from_str(item_name), + name: String::from(item_name), // the rest are ignored action_conn: None, action_opcode: 0, @@ -468,7 +468,7 @@ impl MenuMatic { let op = MenuManagement { item: MenuItem { // dummy item, not used - name: xous_ipc::String::<64>::new(), + name: String::new(), action_conn: None, action_opcode: 0, action_payload: MenuPayload::Scalar([0, 0, 0, 0]), @@ -576,7 +576,7 @@ pub fn menu_matic( } } MenuMgrOp::DeleteItem => { - if !menu.lock().unwrap().delete_item(mgmt.item.name.as_str().unwrap()) { + if !menu.lock().unwrap().delete_item(mgmt.item.name.as_str()) { mgmt.op = MenuMgrOp::Err; } else { mgmt.op = MenuMgrOp::Ok; diff --git a/services/gam/src/modal.rs b/services/gam/src/modal.rs index 62de2aea5..01750901e 100644 --- a/services/gam/src/modal.rs +++ b/services/gam/src/modal.rs @@ -26,7 +26,7 @@ use enum_dispatch::enum_dispatch; pub use graphics_server::api::GlyphStyle; use graphics_server::api::*; use num_traits::*; -use xous_ipc::{Buffer, String}; +use xous_ipc::Buffer; use crate::api::*; use crate::Gam; @@ -69,11 +69,11 @@ pub enum ModalOpcode { /// We use a new type for item names, so that it's easy to resize this as needed. #[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] -pub struct ItemName(String<128>); +pub struct ItemName(String); impl ItemName { - pub fn new(name: &str) -> Self { ItemName(String::<128>::from_str(name)) } + pub fn new(name: &str) -> Self { ItemName(String::from(name)) } - pub fn as_str(&self) -> &str { self.0.as_str().expect("couldn't convert item into string") } + pub fn as_str(&self) -> &str { self.0.as_str() } } #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone, Eq, PartialEq, Default)] @@ -87,8 +87,8 @@ pub struct Bip39EntryPayload { #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone, Eq, PartialEq, Default)] pub struct TextEntryPayload { dirty: bool, - pub content: String<256>, - pub placeholder: Option>, + pub content: String, + pub placeholder: Option, pub placeholder_persist: bool, pub insertion_point: Option, } @@ -104,7 +104,7 @@ impl TextEntryPayload { } } - pub fn new_with_fields(content: String<256>, placeholder: Option>) -> Self { + pub fn new_with_fields(content: String, placeholder: Option) -> Self { TextEntryPayload { dirty: false, content, @@ -118,7 +118,7 @@ impl TextEntryPayload { /// password fields. pub fn volatile_clear(&mut self) { self.content.volatile_clear(); } - pub fn as_str(&self) -> &str { self.content.as_str().expect("couldn't convert textentry string") } + pub fn as_str(&self) -> &str { self.content.as_str() } } #[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] @@ -207,7 +207,7 @@ pub struct Modal<'a> { pub inverted: bool, pub style: GlyphStyle, pub helper_data: Option>, - pub name: String<128>, + pub name: String, // optimize draw time top_dirty: bool, @@ -337,7 +337,7 @@ impl<'a> Modal<'a> { let gam = Gam::new(&xns).expect("can't connect to GAM"); let authtoken = gam .register_ux(UxRegistration { - app_name: String::<128>::from_str(name), + app_name: String::from(name), ux_type: UxType::Modal, predictor: None, listener: sid.to_array(), @@ -391,7 +391,7 @@ impl<'a> Modal<'a> { inverted, style, helper_data: None, - name: String::<128>::from_str(name), + name: String::from(name), top_dirty: true, bot_dirty: true, top_memoized_height: None, @@ -597,7 +597,7 @@ impl<'a> Modal<'a> { self.bot_dirty = true; } - let mut top_tv_temp = String::<3072>::new(); // size matches that used in TextView + let mut top_tv_temp = String::new(); // size matches that used in TextView if let Some(top_text) = update_top_text { write!(top_tv_temp, "{}", top_text).unwrap(); } else { @@ -611,7 +611,7 @@ impl<'a> Modal<'a> { Some(top_tv_temp.to_str()) }; - let mut bot_tv_temp = String::<3072>::new(); // size matches that used in TextView + let mut bot_tv_temp = String::new(); // size matches that used in TextView if let Some(bot_text) = update_bot_text { write!(bot_tv_temp, "{}", bot_text).unwrap(); } else { diff --git a/services/gam/src/modal/slider.rs b/services/gam/src/modal/slider.rs index b9a4ca717..500d4caa0 100644 --- a/services/gam/src/modal/slider.rs +++ b/services/gam/src/modal/slider.rs @@ -19,7 +19,7 @@ pub struct Slider { pub is_progressbar: bool, pub is_password: bool, pub show_legend: bool, - pub units: xous_ipc::String<8>, + pub units: String, } impl Slider { pub fn new( @@ -35,16 +35,16 @@ impl Slider { ) -> Self { let checked_units = if let Some(unit_str) = units { if unit_str.len() < 8 { - String::<8>::from_str(unit_str) + String::from(unit_str) } else { log::error!( "Unit string must be less than 8 *bytes* long (are you using unicode?), ignoring length {} string", unit_str.len() ); - String::<8>::new() + String::new() } } else { - String::<8>::new() // just populate with a blank string, easier than checking Some/None later on everywhere + String::new() // just populate with a blank string, easier than checking Some/None later on everywhere }; Slider {