regex search/replace instances of xous_ipc::String to String

This commit is contained in:
bunnie 2024-09-22 14:24:49 +08:00
parent d2f13d92fe
commit 1b0fa6e04b
7 changed files with 21 additions and 19 deletions

View file

@ -19,8 +19,9 @@ xous-ipc = "0.9.63"
xous-names = { package = "xous-api-names", version = "0.9.61" } xous-names = { package = "xous-api-names", version = "0.9.61" }
num-derive = { version = "0.3.3", default-features = false } num-derive = { version = "0.3.3", default-features = false }
num-traits = { version = "0.2.14", default-features = false } num-traits = { version = "0.2.14", default-features = false }
rkyv = { version = "0.4.3", default-features = false, features = [ rkyv = { version = "0.8.8", default-features = false, features = [
"const_generics", "std",
"alloc",
] } ] }
utralib = { version = "0.1.24", optional = true, default-features = false } utralib = { version = "0.1.24", optional = true, default-features = false }

View file

@ -162,10 +162,10 @@ impl ClipObjectList {
} }
} }
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Clone)]
pub struct TokenClaim { pub struct TokenClaim {
pub token: Option<[u32; 4]>, pub token: Option<[u32; 4]>,
pub name: xous_ipc::String<128>, pub name: String,
} }
/// the buffer length of this equal to the internal length passed by the /// the buffer length of this equal to the internal length passed by the

View file

@ -1,6 +1,6 @@
use core::ops::Add; use core::ops::Add;
use xous_ipc::String; use String;
use crate::api::{Cursor, Gid, GlyphStyle, Point, Rectangle}; use crate::api::{Cursor, Gid, GlyphStyle, Point, Rectangle};
@ -75,7 +75,7 @@ impl From<usize> for TextOp {
const TEXTVIEW_LEN: usize = 3072; const TEXTVIEW_LEN: usize = 3072;
pub const TEXTVIEW_DEFAULT_STYLE: GlyphStyle = GlyphStyle::Regular; pub const TEXTVIEW_DEFAULT_STYLE: GlyphStyle = GlyphStyle::Regular;
#[derive(Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)] #[derive(Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]
pub struct TextView { pub struct TextView {
// this is the operation as specified for the GAM. Note this is different from the "op" when sent to // this is the operation as specified for the GAM. Note this is different from the "op" when sent to
// graphics-server only the GAM should be sending TextViews to the graphics-server, and a different // graphics-server only the GAM should be sending TextViews to the graphics-server, and a different
@ -116,7 +116,7 @@ pub struct TextView {
// this field tracks the state of a busy animation, if `Some` // this field tracks the state of a busy animation, if `Some`
pub busy_animation_state: Option<u32>, pub busy_animation_state: Option<u32>,
pub text: String<3072>, pub text: String,
} }
impl TextView { impl TextView {
pub fn new(canvas: Gid, bounds_hint: TextBounds) -> Self { pub fn new(canvas: Gid, bounds_hint: TextBounds) -> Self {
@ -130,7 +130,7 @@ impl TextView {
bounds_hint, bounds_hint,
bounds_computed: None, bounds_computed: None,
style: TEXTVIEW_DEFAULT_STYLE, style: TEXTVIEW_DEFAULT_STYLE,
text: String::<3072>::new(), text: String::new(),
cursor: Cursor::new(0, 0, 0), cursor: Cursor::new(0, 0, 0),
insertion: None, insertion: None,
ellipsis: false, ellipsis: false,
@ -156,7 +156,7 @@ impl TextView {
pub fn get_canvas_gid(&self) -> Gid { self.canvas } pub fn get_canvas_gid(&self) -> Gid { self.canvas }
pub fn to_str(&self) -> &str { self.text.as_str().unwrap() } pub fn to_str(&self) -> &str { self.text.as_str() }
pub fn clear_str(&mut self) { self.text.clear() } pub fn clear_str(&mut self) { self.text.clear() }
@ -169,7 +169,7 @@ impl TextView {
self.bounds_hint = t.bounds_hint; self.bounds_hint = t.bounds_hint;
self.bounds_computed = t.bounds_computed; self.bounds_computed = t.bounds_computed;
self.style = t.style; self.style = t.style;
self.text = t.text; self.text = t.text.clone();
self.cursor = t.cursor; self.cursor = t.cursor;
self.draw_border = t.draw_border; self.draw_border = t.draw_border;
self.clear_area = t.clear_area; self.clear_area = t.clear_area;

View file

@ -135,7 +135,7 @@ impl Gfx {
} }
pub fn draw_textview(&self, tv: &mut TextView) -> Result<(), xous::Error> { pub fn draw_textview(&self, tv: &mut TextView) -> Result<(), xous::Error> {
let mut buf = Buffer::into_buf(*tv).or(Err(xous::Error::InternalError))?; let mut buf = Buffer::into_buf(tv.clone()).or(Err(xous::Error::InternalError))?;
buf.lend_mut(self.conn, Opcode::DrawTextView.to_u32().unwrap()) buf.lend_mut(self.conn, Opcode::DrawTextView.to_u32().unwrap())
.or(Err(xous::Error::InternalError))?; .or(Err(xous::Error::InternalError))?;

View file

@ -22,8 +22,9 @@ spinor = { path = "../spinor" }
num-derive = { version = "0.3.3", default-features = false } num-derive = { version = "0.3.3", default-features = false }
num-traits = { version = "0.2.14", default-features = false } num-traits = { version = "0.2.14", default-features = false }
rkyv = { version = "0.4.3", default-features = false, features = [ rkyv = { version = "0.8.8", default-features = false, features = [
"const_generics", "std",
"alloc",
] } ] }
utralib = { version = "0.1.24", optional = true, default-features = false } utralib = { version = "0.1.24", optional = true, default-features = false }

View file

@ -107,9 +107,9 @@ pub(crate) enum Opcode {
// this structure is used to register a keyboard listener. Currently, we only accept // this structure is used to register a keyboard listener. Currently, we only accept
// one trusted listener (enforced by name server and structurally in the code), // one trusted listener (enforced by name server and structurally in the code),
// which is the GAM. // which is the GAM.
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Clone)]
pub(crate) struct KeyboardRegistration { pub(crate) struct KeyboardRegistration {
pub server_name: xous_ipc::String<64>, pub server_name: String,
pub listener_op_id: usize, pub listener_op_id: usize,
} }

View file

@ -6,7 +6,7 @@ pub mod api;
pub use api::*; pub use api::*;
use xous::{send_message, Message}; use xous::{send_message, Message};
use xous_ipc::{Buffer, String}; use xous_ipc::Buffer;
#[derive(Debug)] #[derive(Debug)]
pub struct Keyboard { pub struct Keyboard {
@ -21,7 +21,7 @@ impl Keyboard {
pub fn register_listener(&self, server_name: &str, action_opcode: usize) { pub fn register_listener(&self, server_name: &str, action_opcode: usize) {
let kr = KeyboardRegistration { let kr = KeyboardRegistration {
server_name: String::<64>::from_str(server_name), server_name: String::from(server_name),
listener_op_id: action_opcode, listener_op_id: action_opcode,
}; };
let buf = Buffer::into_buf(kr).unwrap(); let buf = Buffer::into_buf(kr).unwrap();
@ -30,7 +30,7 @@ impl Keyboard {
pub fn register_raw_listener(&self, server_name: &str, action_opcode: usize) { pub fn register_raw_listener(&self, server_name: &str, action_opcode: usize) {
let kr = KeyboardRegistration { let kr = KeyboardRegistration {
server_name: String::<64>::from_str(server_name), server_name: String::from(server_name),
listener_op_id: action_opcode, listener_op_id: action_opcode,
}; };
let buf = Buffer::into_buf(kr).unwrap(); let buf = Buffer::into_buf(kr).unwrap();
@ -40,7 +40,7 @@ impl Keyboard {
pub fn register_observer(&self, server_name: &str, action_opcode: usize) { pub fn register_observer(&self, server_name: &str, action_opcode: usize) {
let kr = KeyboardRegistration { let kr = KeyboardRegistration {
server_name: String::<64>::from_str(server_name), server_name: String::from(server_name),
listener_op_id: action_opcode, listener_op_id: action_opcode,
}; };
let buf = Buffer::into_buf(kr).unwrap(); let buf = Buffer::into_buf(kr).unwrap();