diff --git a/libs/chat/Cargo.toml b/libs/chat/Cargo.toml index 7fdf23574..5d660c019 100644 --- a/libs/chat/Cargo.toml +++ b/libs/chat/Cargo.toml @@ -30,8 +30,9 @@ cos_table = { path = "../../libs/cos_table" } pddb = { path = "../../services/pddb" } enumset = "1.1.2" -rkyv = { version = "0.4.3", default-features = false, features = [ - "const_generics", +rkyv = { version = "0.8.8", default-features = false, features = [ + "std", + "alloc", ] } [features] diff --git a/libs/chat/src/api.rs b/libs/chat/src/api.rs index e40e97ea5..e3babe6a3 100644 --- a/libs/chat/src/api.rs +++ b/libs/chat/src/api.rs @@ -69,24 +69,24 @@ pub const POST_TEXT_MAX: usize = 3072; #[derive(Archive, Serialize, Deserialize, Debug)] pub struct Find { - pub author: xous_ipc::String<128>, + pub author: String, pub timestamp: u64, pub key: Option, // the return post key if found. } #[derive(Archive, Serialize, Deserialize, Debug)] pub struct Dialogue { - pub dict: xous_ipc::String<128>, - pub key: Option>, + pub dict: String, + pub key: Option, } #[derive(Archive, Serialize, Deserialize, Debug)] pub struct Post { - pub dialogue_id: xous_ipc::String<128>, - pub author: xous_ipc::String<128>, + pub dialogue_id: String, + pub author: String, pub timestamp: u64, - pub text: xous_ipc::String, - pub attach_url: Option>, + pub text: String, + pub attach_url: Option, } /// Events are sent to the Chat App when key things occur in the Chat UI @@ -128,5 +128,5 @@ pub enum AuthorFlag { #[derive(Archive, Serialize, Deserialize, Debug)] pub struct BusyMessage { - pub busy_msg: xous_ipc::String<128>, + pub busy_msg: String, } diff --git a/libs/chat/src/lib.rs b/libs/chat/src/lib.rs index 047a80a6e..d42c0cf0d 100644 --- a/libs/chat/src/lib.rs +++ b/libs/chat/src/lib.rs @@ -176,8 +176,8 @@ impl Chat { /// * `pddb_key` - the pddb key holding a Dialogue pub fn dialogue_set(&self, pddb_dict: &str, pddb_key: Option<&str>) -> Result<(), Error> { let dialogue = api::Dialogue { - dict: xous_ipc::String::from_str(pddb_dict), - key: pddb_key.map(|key| xous_ipc::String::from_str(key)), + dict: String::from(pddb_dict), + key: pddb_key.map(|key| String::from(key)), }; match Buffer::into_buf(dialogue) { Ok(buf) => buf.send(self.cid, ChatOp::DialogueSet as u32).map(|_| ()), @@ -224,12 +224,12 @@ impl Chat { attach_url: Option<&str>, ) -> Result<(), Error> { let mut post = api::Post { - dialogue_id: xous_ipc::String::new(), - author: xous_ipc::String::new(), + dialogue_id: String::new(), + author: String::new(), timestamp, - text: xous_ipc::String::new(), + text: String::new(), attach_url: match attach_url { - Some(url) => Some(xous_ipc::String::from_str(url)), + Some(url) => Some(String::from(url)), None => None, }, }; @@ -262,7 +262,7 @@ impl Chat { /// /// Error if unable to send the msg to the Chat UI server pub fn post_find(&self, author: &str, timestamp: u64) -> Result, Error> { - let mut find = Find { author: xous_ipc::String::new(), timestamp, key: None }; + let mut find = Find { author: String::new(), timestamp, key: None }; find.author.append(author).unwrap(); match Buffer::into_buf(find) { Ok(mut buf) => match buf.lend_mut(self.cid, ChatOp::PostFind as u32) { @@ -299,7 +299,7 @@ impl Chat { /// /// This method implements the latest recommendation of panicing on internal errors. pub fn set_status_text(&self, msg: &str) { - let bm = BusyMessage { busy_msg: xous_ipc::String::from_str(msg) }; + let bm = BusyMessage { busy_msg: String::from(msg) }; Buffer::into_buf(bm) .expect("internal error") .send(self.cid, ChatOp::SetStatusText as u32) @@ -326,7 +326,7 @@ impl Chat { /// and update the text, especially when we have multiple potential servers vying /// to set a busy state. pub fn set_status_idle_text(&self, msg: &str) { - let bm = BusyMessage { busy_msg: xous_ipc::String::from_str(msg) }; + let bm = BusyMessage { busy_msg: String::from(msg) }; Buffer::into_buf(bm) .expect("internal error") .send(self.cid, ChatOp::SetStatusIdleText as u32) @@ -427,12 +427,12 @@ pub fn server( Some(ChatOp::SetStatusText) => { let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; let s = buffer.to_original::().unwrap(); - ui.set_status_text(s.busy_msg.as_str().unwrap()); + ui.set_status_text(s.busy_msg.as_str()); } Some(ChatOp::SetStatusIdleText) => { let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; let s = buffer.to_original::().unwrap(); - ui.set_status_idle_text(s.busy_msg.as_str().unwrap()); + ui.set_status_idle_text(s.busy_msg.as_str()); } Some(ChatOp::SetBusyAnimationState) => msg_scalar_unpack!(msg, state, _, _, _, { if state != 0 { @@ -467,7 +467,7 @@ pub fn server( Some(key) => Some(key.to_string()), None => None, }; - ui.dialogue_set(dialogue.dict.as_str().unwrap(), dialogue_key.as_deref()); + ui.dialogue_set(dialogue.dict.as_str(), dialogue_key.as_deref()); } Some(ChatOp::GamChangeFocus) => { log::info!("ChatOp::GamChangeFocus"); @@ -487,7 +487,7 @@ pub fn server( Some(ChatOp::GamLine) => { log::info!("got ChatOp::GamLine"); let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; - let s = buffer.as_flat::, _>().unwrap(); + let s = buffer.as_flat::().unwrap(); match s.as_str() { "\u{0011}" => {} "\u{0012}" => {} @@ -588,9 +588,9 @@ pub fn server( Ok(post) => ui .post_add( &dialogue_id, - post.author.as_str().unwrap(), + post.author.as_str(), post.timestamp, - post.text.as_str().unwrap(), + post.text.as_str(), None, // TODO implement ) .unwrap(), @@ -610,7 +610,7 @@ pub fn server( log::info!("ChatOp::PostAdd"); let mut buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) }; if let Ok(mut find) = buffer.to_original::() { - find.key = ui.post_find(find.author.as_str().unwrap(), find.timestamp); + find.key = ui.post_find(find.author.as_str(), find.timestamp); buffer.replace(find).expect("couldn't serialize return"); } else { log::warn!("failed to serialize Find"); @@ -648,7 +648,7 @@ pub fn now() -> u64 { SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_s /// "context-free" (cf) communication with the chat object. /// This is accomplished by making a copy of the connection to the chat server. pub fn cf_set_status_text(chat_cid: xous::CID, msg: &str) { - let bm = BusyMessage { busy_msg: xous_ipc::String::from_str(msg) }; + let bm = BusyMessage { busy_msg: String::from(msg) }; Buffer::into_buf(bm) .expect("internal error") .send(chat_cid, ChatOp::SetStatusText as u32) diff --git a/libs/chat/src/ui.rs b/libs/chat/src/ui.rs index 8c3ca83e7..5dccfc0f7 100644 --- a/libs/chat/src/ui.rs +++ b/libs/chat/src/ui.rs @@ -40,7 +40,7 @@ pub struct VisualProperties { pub(crate) struct Ui { // optional structures that indicate new input to the Chat loop per iteration // an input string - pub input: Option>, + pub input: Option>, // messages from other servers msg: Option, @@ -105,9 +105,9 @@ impl Ui { let token = gam .register_ux(UxRegistration { - app_name: xous_ipc::String::<128>::from_str(app_name), + app_name: String::from(app_name), ux_type: gam::UxType::Chat, - predictor: Some(xous_ipc::String::<64>::from_str(crate::icontray::SERVER_NAME_ICONTRAY)), + predictor: Some(String::from(crate::icontray::SERVER_NAME_ICONTRAY)), listener: sid.to_array(), /* note disclosure of our SID to the GAM -- the secret is now * shared with the GAM! */ redraw_id: ChatOp::GamRedraw as u32, diff --git a/libs/cramium-hal/Cargo.toml b/libs/cramium-hal/Cargo.toml index 620e3b9a3..a29d2e628 100644 --- a/libs/cramium-hal/Cargo.toml +++ b/libs/cramium-hal/Cargo.toml @@ -12,8 +12,9 @@ utralib = { version = "0.1.24", default-features = false, features = [ "cramium-soc", ] } bitflags = "1.2.1" -rkyv = { version = "0.4.3", default-features = false, features = [ - "const_generics", +rkyv = { version = "0.8.8", default-features = false, features = [ + "std", + "alloc", ], optional = true } num-derive = { version = "0.3.3", default-features = false } num-traits = { version = "0.2.14", default-features = false } diff --git a/libs/tls/Cargo.toml b/libs/tls/Cargo.toml index 31e8530ef..635d33220 100644 --- a/libs/tls/Cargo.toml +++ b/libs/tls/Cargo.toml @@ -21,7 +21,10 @@ pddb = { path = "../../services/pddb" } der = { version = "0.7.6", features = ["derive"] } locales = { path = "../../locales" } -rkyv = "0.4.3" +rkyv = { version = "0.8.8", default-features = false, features = [ + "std", + "alloc", +] } sha2 = { version = "0.10.8" } # note requirement for patch to xous-ring in workspace Cargo.toml