minor refinements requested on PR

This commit is contained in:
nworbnhoj 2022-04-24 20:09:43 +10:00
parent e879ff4b17
commit 2070236695
4 changed files with 11 additions and 11 deletions

View file

@ -20,7 +20,7 @@ gam = {path="../gam"}
trng = {path="../trng"} trng = {path="../trng"}
tts-frontend = {path="../tts"} tts-frontend = {path="../tts"}
locales = {path = "../../locales"} locales = {path = "../../locales"}
bit_field = "0.10.1" bit_field = "0.9.0"
[target.'cfg(not(any(windows,unix)))'.dependencies] [target.'cfg(not(any(windows,unix)))'.dependencies]
utralib = { path = "../../utralib"} utralib = { path = "../../utralib"}

View file

@ -141,7 +141,7 @@ impl Modals {
Ok(()) Ok(())
} }
pub fn add_list(&mut self, items: Vec<&str>) -> Result<(), xous::Error> { pub fn add_list(&self, items: Vec<&str>) -> Result<(), xous::Error> {
for (_, text) in items.iter().enumerate() { for (_, text) in items.iter().enumerate() {
self.add_list_item(text) self.add_list_item(text)
.or(Err(xous::Error::InternalError))?; .or(Err(xous::Error::InternalError))?;
@ -178,10 +178,10 @@ impl Modals {
match send_message(self.conn, msg) { match send_message(self.conn, msg) {
Ok(xous::Result::Scalar1(bitfield)) => { Ok(xous::Result::Scalar1(bitfield)) => {
let mut i = 0; let mut i = 0;
while (i < u32::BIT_LENGTH) & !bitfield.get_bit(i) { while (i < u32::bit_length()) & !bitfield.get_bit(i) {
i = i + 1; i = i + 1;
} }
if i < u32::BIT_LENGTH { if i < u32::bit_length() {
Ok(i) Ok(i)
} else { } else {
Err(xous::Error::InternalError) Err(xous::Error::InternalError)
@ -216,7 +216,7 @@ impl Modals {
match send_message(self.conn, msg) { match send_message(self.conn, msg) {
Ok(xous::Result::Scalar1(bitfield)) => { Ok(xous::Result::Scalar1(bitfield)) => {
let mut i = 0; let mut i = 0;
while i < u32::BIT_LENGTH { while i < u32::bit_length() {
if bitfield.get_bit(i) { if bitfield.get_bit(i) {
ret.push(i); ret.push(i);
} }

View file

@ -31,7 +31,7 @@ pub(crate) fn spawn_test() {
thread::spawn({ thread::spawn({
move || { move || {
let xns = XousNames::new().unwrap(); let xns = XousNames::new().unwrap();
let mut modals = modals::Modals::new(&xns).unwrap(); let modals = modals::Modals::new(&xns).unwrap();
let tt = ticktimer_server::Ticktimer::new().unwrap(); let tt = ticktimer_server::Ticktimer::new().unwrap();
// 1. test progress bar // 1. test progress bar