Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ app! {
},
}

fn init(p: init::Peripherals) -> init::LateResourceValues {
init::LateResourceValues {
fn init(p: init::Peripherals) -> init::LateResources {
init::LateResources {
GPIOA: p.device.GPIOA,
SPI1: p.device.SPI1,
}
Expand Down
4 changes: 2 additions & 2 deletions examples/late-resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ app! {
}

// The signature of `init` is now required to have a specific return type.
fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues {
fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResources {
// `init::Resources` does not contain `IP_ADDRESS`, since it is not yet
// initialized.
//_r.IP_ADDRESS; // doesn't compile

// ...obtain value for IP_ADDRESS from EEPROM/DHCP...
let ip_address = 0x7f000001;

init::LateResourceValues {
init::LateResources {
// This struct will contain fields for all resources with omitted
// initializers.
IP_ADDRESS: ip_address,
Expand Down
6 changes: 3 additions & 3 deletions macros/src/trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,17 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
root.push(quote! {
#[allow(non_camel_case_types)]
#[allow(non_snake_case)]
pub struct _initLateResourceValues {
pub struct _initLateResources {
#(#fields)*
}
});

mod_items.push(quote! {
pub use ::_initLateResourceValues as LateResourceValues;
pub use ::_initLateResources as LateResources;
});

// `init` must return the initialized resources
ret = Some(quote!( -> ::init::LateResourceValues));
ret = Some(quote!( -> ::init::LateResources));
}

root.push(quote! {
Expand Down
4 changes: 2 additions & 2 deletions src/examples/_5_late_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
//! }
//!
//! // The signature of `init` is now required to have a specific return type.
//! fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues {
//! fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResources {
//! // `init::Resources` does not contain `IP_ADDRESS`, since it is not yet
//! // initialized.
//! //_r.IP_ADDRESS; // doesn't compile
//!
//! // ...obtain value for IP_ADDRESS from EEPROM/DHCP...
//! let ip_address = 0x7f000001;
//!
//! init::LateResourceValues {
//! init::LateResources {
//! // This struct will contain fields for all resources with omitted
//! // initializers.
//! IP_ADDRESS: ip_address,
Expand Down
4 changes: 2 additions & 2 deletions tests/cfail/late-resource-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ app! {
},
}

fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResourceValues {
fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResources {
// Try to use a resource that's not yet initialized:
r.LATE;
//~^ error: no field `LATE`

init::LateResourceValues {
init::LateResources {
LATE: 0,
}
}
Expand Down