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
5 changes: 4 additions & 1 deletion power-policy-service/src/charger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ where
// Push will never fail since the number of receivers is the same as the capacity of the vector
let _ = futures.push(async move { (receiver.wait_next().await, psu) });
}
select_slice(pin!(&mut futures)).await
// Pin the futures and deference to a slice
Comment thread
RobertZ2011 marked this conversation as resolved.
let pinned = pin!(futures);
// Safety: The backing buffer is contained within the heapless::Vec so it won't be moved either.
Comment thread
RobertZ2011 marked this conversation as resolved.
select_slice(unsafe { pinned.map_unchecked_mut(|f| f.as_mut()) }).await
};

Event { charger, event }
Expand Down
5 changes: 4 additions & 1 deletion power-policy-service/src/psu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ where
// Push will never fail since the number of receivers is the same as the capacity of the vector
let _ = futures.push(async move { (receiver.wait_next().await, psu) });
}
select_slice(pin!(&mut futures)).await
// Pin the futures and deference to a slice
Comment thread
RobertZ2011 marked this conversation as resolved.
let pinned = pin!(futures);
// Safety: The backing buffer is contained within the heapless::Vec so it won't be moved either.
Comment thread
RobertZ2011 marked this conversation as resolved.
select_slice(unsafe { pinned.map_unchecked_mut(|f| f.as_mut()) }).await
};

Event { psu, event }
Expand Down
5 changes: 4 additions & 1 deletion type-c-service/src/service/event_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ impl<
// Push will never fail since the number of receivers is the same as the capacity of the vector
let _ = futures.push(async move { (receiver.wait_next().await, psu) });
}
select_slice(pin!(&mut futures)).await
// Pin the futures and deference to a slice
Comment thread
RobertZ2011 marked this conversation as resolved.
let pinned = pin!(futures);
// Safety: The backing buffer is contained within the heapless::Vec so it won't be moved either.
Comment thread
RobertZ2011 marked this conversation as resolved.
select_slice(unsafe { pinned.map_unchecked_mut(|f| f.as_mut()) }).await
};

Event::PortEvent(PortEvent { port: *port, event })
Expand Down
Loading