Skip to content
Snippets Groups Projects
Commit 42c3efdc authored by Gustav Hansson's avatar Gustav Hansson
Browse files

bare3_5

parent 021545b2
Branches
No related tags found
No related merge requests found
...@@ -15,6 +15,8 @@ extern crate panic_halt; ...@@ -15,6 +15,8 @@ extern crate panic_halt;
use cortex_m_rt::entry; use cortex_m_rt::entry;
use cortex_m_semihosting::{hprint, hprintln}; use cortex_m_semihosting::{hprint, hprintln};
use core::convert::TryInto;
#[entry] #[entry]
fn main() -> ! { fn main() -> ! {
hprintln!("bare3").unwrap(); hprintln!("bare3").unwrap();
...@@ -29,14 +31,17 @@ fn main() -> ! { ...@@ -29,14 +31,17 @@ fn main() -> ! {
hprint!("{},", c as &u8).unwrap(); hprint!("{},", c as &u8).unwrap();
} }
let mut a = [0u8; 4];
hprintln!("iterate iterate using (raw) indexing").unwrap(); hprintln!("iterate iterate using (raw) indexing").unwrap();
for i in 0usize..s.len() { for i in 0usize..s.len() {
hprintln!("{},", bs[i]).unwrap(); hprintln!("{},", bs[i]).unwrap();
a[i] = bs[i]; // a[i] = bs[i];
} }
let a: [u8; 4];
// a = bs.into();
a = bs.try_into().expect("incorrect length");
hprintln!("").unwrap(); hprintln!("").unwrap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment