Created
July 27, 2020 03:55
-
-
Save mtthw-meyer/a091e0adf5cd20d1880ebe82c9164a49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct Audio { | |
pub stream: sai::Sai<stm32::SAI1, sai::I2S>, | |
input: &'static mut IoBuffer, | |
output: &'static mut IoBuffer, | |
} | |
impl Audio { | |
pub fn new( | |
mut stream: sai::Sai<stm32::SAI1, sai::I2S>, | |
input: &'static mut IoBuffer, | |
output: &'static mut IoBuffer, | |
) -> Self { | |
stream.listen(SaiChannel::ChannelB, Event::Data); | |
stream.enable(); | |
stream.try_send(0, 0).unwrap(); | |
Audio { | |
stream, | |
input, | |
output, | |
} | |
} | |
pub fn get_lifetime_errors(&mut self) -> &'static [u32] { | |
&self.input[..2] | |
} | |
} | |
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements | |
--> src/audio.rs:67:10 | |
| | |
67 | &self.input[..2] | |
| ^^^^^^^^^^^^^^^ | |
| | |
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 66:5... | |
--> src/audio.rs:66:5 | |
| | |
66 | / pub fn get_lifetime_errors(&mut self) -> &'static [u32] { | |
67 | | &self.input[..2] | |
68 | | } | |
| |_____^ | |
note: ...so that reference does not outlive borrowed content | |
--> src/audio.rs:67:10 | |
| | |
67 | &self.input[..2] | |
| ^^^^^^^^^^ | |
= note: but, the lifetime must be valid for the static lifetime... | |
note: ...so that reference does not outlive borrowed content | |
--> src/audio.rs:67:9 | |
| | |
67 | &self.input[..2] | |
| ^^^^^^^^^^^^^^^^ | |
error: aborting due to previous error | |
For more information about this error, try `rustc --explain E0495`. | |
error: could not compile `libdaisy-rust`. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment