elide lifetime

This commit is contained in:
Patrick Moessler 2025-03-22 00:48:32 +01:00
parent 4f29e7515f
commit 750fb3a204

View file

@ -45,7 +45,7 @@ pub struct Sender<'a, M: RawMutex, T> {
buffer: &'a TripleBuffer<'a, M, T>,
}
impl<'a, M: RawMutex, T> Sender<'a, M, T> {
impl<M: RawMutex, T> Sender<'_, M, T> {
/// Asynchronously send a value into the buffer.
pub fn send(&mut self) -> impl Future<Output = &mut T> {
poll_fn(|_| {
@ -68,7 +68,7 @@ pub struct Receiver<'a, M: RawMutex, T> {
buffer: &'a TripleBuffer<'a, M, T>,
}
impl<'a, M: RawMutex, T> Receiver<'a, M, T> {
impl<M: RawMutex, T> Receiver<'_, M, T> {
/// Checks if the buffer has data available
pub fn is_ready(&self) -> bool {
self.buffer.state.lock(|s| s.borrow_mut().output.is_some())
@ -138,12 +138,9 @@ impl State {
self.send_waker.wake();
}
fn flip_output(&mut self) {
match self.output {
Some(o) => {
(self.output, self.internal) = (Some(self.internal), o);
self.new_data = false;
}
None => {}
if let Some(o) = self.output {
(self.output, self.internal) = (Some(self.internal), o);
self.new_data = false;
}
}
}