Merge pull request 'remove unsafe API' (#49) from remove-unsafe into main
shared-hal-ci / Check build (push) Has been cancelled
shared-hal-ci / Check formatting (push) Has been cancelled
shared-hal-ci / Check Documentation Build (push) Has been cancelled
shared-hal-ci / Clippy (push) Has been cancelled
va108xx-ci / Run Tests (push) Has been cancelled
va108xx-ci / Check formatting (push) Has been cancelled
va108xx-ci / Check Documentation Build (push) Has been cancelled
va108xx-ci / Clippy (push) Has been cancelled
va416xx-ci / Run Tests (push) Has been cancelled
va416xx-ci / Check formatting (push) Has been cancelled
va416xx-ci / Check Documentation Build (push) Has been cancelled
va416xx-ci / Clippy (push) Has been cancelled
va108xx-ci / Check build (push) Has been cancelled
va416xx-ci / Check build (push) Has been cancelled

Reviewed-on: #49
This commit was merged in pull request #49.
This commit is contained in:
2026-06-22 16:37:27 +02:00
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -614,7 +614,8 @@ impl SpiAsync {
///
/// The user MUST ensure that the `Drop` method of all futures generated with this driver
/// is called on transfer cancellation. By default, this does not require any special handling.
pub unsafe fn new(
/// This case was considered exotic enough to justify not making the function `unsafe`.
pub fn new(
mut spi: super::Spi<u8>,
#[cfg(feature = "vor1x")] opt_irq_cfg: Option<crate::InterruptConfig>,
) -> Self {
+3 -2
View File
@@ -125,7 +125,8 @@ impl<'uart, 'buf> TxFuture<'uart, 'buf> {
///
/// This function stores the raw pointer of the passed data slice. The user MUST ensure
/// that the slice outlives the data structure.
pub unsafe fn new(tx: &'uart mut Tx, data: &'buf [u8]) -> Self {
/// This case was considered exotic enough to justify not making the function `unsafe`.
pub fn new(tx: &'uart mut Tx, data: &'buf [u8]) -> Self {
if data.is_empty() {
// We can just return a dummy future which is immediately ready, no need to set up
// interrupts etc.
@@ -227,7 +228,7 @@ impl TxAsync {
/// This implementation is not side effect free, and a started future might have already
/// written part of the passed buffer.
pub fn write<'buf>(&mut self, buf: &'buf [u8]) -> TxFuture<'_, 'buf> {
unsafe { TxFuture::new(&mut self.0, buf) }
TxFuture::new(&mut self.0, buf)
}
/// Write an entire buffer into this writer.