pub struct Regions { /* private fields */ }Implementations§
Source§impl Regions
impl Regions
pub fn region(&self) -> &Region
Sourcepub fn origin(&self) -> u64
pub fn origin(&self) -> u64
Examples found in repository?
examples/print_to_stdout.rs (line 15)
4fn main() {
5 let content = std::fs::read_to_string("examples/memory.kdl").unwrap();
6 let memoryspec = match MemorySpec::from_str(&content) {
7 Ok(m) => m,
8 Err(e) => {
9 eprintln!("{}", e);
10 return;
11 }
12 };
13
14 let primary_slot = &memoryspec.regions()["appcore_flash"]["primary_slot"];
15 let primary_slot_origin = primary_slot.origin();
16 let primary_slot_length = primary_slot.length();
17 let appcore_ram = &memoryspec.regions()["appcore_ram"]["low_ram"];
18 let appcore_ram_origin = appcore_ram.origin();
19 let appcore_ram_length = appcore_ram.length();
20 let symbols = memoryspec.render_symbols();
21 let consts = memoryspec.render_consts();
22
23 let output = println!(
24 "\
25memory.x:
26MEMORY
27{{
28 FLASH : ORIGIN = 0x{primary_slot_origin:08x}, LENGTH = 0x{primary_slot_length:04x}
29 RAM : ORIGIN = 0x{appcore_ram_origin:08x}, LENGTH = 0x{appcore_ram_length:04x}
30}}
31{symbols}
32
33
34consts.rs:
35{consts}"
36 );
37}Sourcepub fn length(&self) -> u64
pub fn length(&self) -> u64
Examples found in repository?
examples/print_to_stdout.rs (line 16)
4fn main() {
5 let content = std::fs::read_to_string("examples/memory.kdl").unwrap();
6 let memoryspec = match MemorySpec::from_str(&content) {
7 Ok(m) => m,
8 Err(e) => {
9 eprintln!("{}", e);
10 return;
11 }
12 };
13
14 let primary_slot = &memoryspec.regions()["appcore_flash"]["primary_slot"];
15 let primary_slot_origin = primary_slot.origin();
16 let primary_slot_length = primary_slot.length();
17 let appcore_ram = &memoryspec.regions()["appcore_ram"]["low_ram"];
18 let appcore_ram_origin = appcore_ram.origin();
19 let appcore_ram_length = appcore_ram.length();
20 let symbols = memoryspec.render_symbols();
21 let consts = memoryspec.render_consts();
22
23 let output = println!(
24 "\
25memory.x:
26MEMORY
27{{
28 FLASH : ORIGIN = 0x{primary_slot_origin:08x}, LENGTH = 0x{primary_slot_length:04x}
29 RAM : ORIGIN = 0x{appcore_ram_origin:08x}, LENGTH = 0x{appcore_ram_length:04x}
30}}
31{symbols}
32
33
34consts.rs:
35{consts}"
36 );
37}pub fn end(&self) -> u64
pub fn get(&self, key: &str) -> Option<&Regions>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Regions
impl RefUnwindSafe for Regions
impl Send for Regions
impl Sync for Regions
impl Unpin for Regions
impl UnwindSafe for Regions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more