Rename unsafe_impl_unborrow to impl_unborrow

This commit is contained in:
Dario Nieuwenhuis
2022-07-22 22:00:12 +02:00
parent f9f2de3dfb
commit be6408e202
10 changed files with 25 additions and 36 deletions

View File

@ -4,7 +4,7 @@ use core::convert::Infallible;
use core::hint::unreachable_unchecked;
use cfg_if::cfg_if;
use embassy_hal_common::{unborrow, unsafe_impl_unborrow, Unborrowed};
use embassy_hal_common::{impl_unborrow, unborrow, Unborrowed};
use self::sealed::Pin as _;
use crate::pac::p0 as gpio;
@ -432,7 +432,7 @@ macro_rules! unborrow_and_degrade {
};
}
unsafe_impl_unborrow!(AnyPin);
impl_unborrow!(AnyPin);
impl Pin for AnyPin {}
impl sealed::Pin for AnyPin {
#[inline]

View File

@ -4,7 +4,7 @@ use core::marker::PhantomData;
use core::task::{Context, Poll};
use embassy::waitqueue::AtomicWaker;
use embassy_hal_common::unsafe_impl_unborrow;
use embassy_hal_common::impl_unborrow;
use futures::future::poll_fn;
use crate::gpio::sealed::Pin as _;
@ -414,7 +414,7 @@ pub trait Channel: sealed::Channel + Sized {
pub struct AnyChannel {
number: u8,
}
unsafe_impl_unborrow!(AnyChannel);
impl_unborrow!(AnyChannel);
impl sealed::Channel for AnyChannel {}
impl Channel for AnyChannel {
fn number(&self) -> usize {

View File

@ -17,7 +17,7 @@
use core::ptr::NonNull;
use embassy_hal_common::{unsafe_impl_unborrow, Unborrowed};
use embassy_hal_common::{impl_unborrow, Unborrowed};
use crate::{peripherals, Unborrow};
@ -117,7 +117,7 @@ pub trait Group: sealed::Group + Sized {
pub struct AnyStaticChannel {
pub(crate) number: u8,
}
unsafe_impl_unborrow!(AnyStaticChannel);
impl_unborrow!(AnyStaticChannel);
impl sealed::Channel for AnyStaticChannel {}
impl Channel for AnyStaticChannel {
fn number(&self) -> usize {
@ -135,7 +135,7 @@ impl StaticChannel for AnyStaticChannel {
pub struct AnyConfigurableChannel {
pub(crate) number: u8,
}
unsafe_impl_unborrow!(AnyConfigurableChannel);
impl_unborrow!(AnyConfigurableChannel);
impl sealed::Channel for AnyConfigurableChannel {}
impl Channel for AnyConfigurableChannel {
fn number(&self) -> usize {
@ -187,7 +187,7 @@ macro_rules! impl_ppi_channel {
pub struct AnyGroup {
number: u8,
}
unsafe_impl_unborrow!(AnyGroup);
impl_unborrow!(AnyGroup);
impl sealed::Group for AnyGroup {}
impl Group for AnyGroup {
fn number(&self) -> usize {

View File

@ -5,7 +5,7 @@ use core::sync::atomic::{compiler_fence, Ordering};
use core::task::Poll;
use embassy::waitqueue::AtomicWaker;
use embassy_hal_common::{unborrow, unsafe_impl_unborrow};
use embassy_hal_common::{impl_unborrow, unborrow};
use futures::future::poll_fn;
use pac::{saadc, SAADC};
use saadc::ch::config::{GAIN_A, REFSEL_A, RESP_A, TACQ_A};
@ -77,7 +77,7 @@ pub struct ChannelConfig<'d> {
/// internal voltage.
pub struct VddInput;
unsafe_impl_unborrow!(VddInput);
impl_unborrow!(VddInput);
impl sealed::Input for VddInput {
#[cfg(not(feature = "_nrf9160"))]
@ -97,7 +97,7 @@ impl Input for VddInput {}
pub struct VddhDiv5Input;
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
unsafe_impl_unborrow!(VddhDiv5Input);
impl_unborrow!(VddhDiv5Input);
#[cfg(any(feature = "_nrf5340-app", feature = "nrf52833", feature = "nrf52840"))]
impl sealed::Input for VddhDiv5Input {
@ -113,12 +113,7 @@ pub struct AnyInput {
channel: InputChannel,
}
unsafe impl Unborrow for AnyInput {
type Target = AnyInput;
unsafe fn unborrow(self) -> Self::Target {
self
}
}
impl_unborrow!(AnyInput);
impl sealed::Input for AnyInput {
fn channel(&self) -> InputChannel {