stm32 CORDIC: use private_bounds for sealed traits.

This commit is contained in:
eZio Pan 2024-03-23 09:04:09 +08:00
parent 0abcccee96
commit 8fa1d06a6a
2 changed files with 7 additions and 11 deletions

View File

@ -11,16 +11,11 @@ pub use enums::*;
mod errors;
pub use errors::*;
mod sealed;
use self::sealed::SealedInstance;
pub mod utils;
pub(crate) mod sealed;
/// Low-level CORDIC access.
#[cfg(feature = "unstable-pac")]
pub mod low_level {
pub use super::sealed::*;
}
/// CORDIC driver
pub struct Cordic<'d, T: Instance> {
peri: PeripheralRef<'d, T>,
@ -28,7 +23,8 @@ pub struct Cordic<'d, T: Instance> {
}
/// CORDIC instance trait
pub trait Instance: sealed::Instance + Peripheral<P = Self> + crate::rcc::RccPeripheral {}
#[allow(private_bounds)]
pub trait Instance: SealedInstance + Peripheral<P = Self> + crate::rcc::RccPeripheral {}
/// CORDIC configuration
#[derive(Debug)]
@ -609,7 +605,7 @@ foreach_interrupt!(
impl Instance for peripherals::$inst {
}
impl sealed::Instance for peripherals::$inst {
impl SealedInstance for peripherals::$inst {
fn regs() -> crate::pac::cordic::Cordic {
crate::pac::$inst
}

View File

@ -2,7 +2,7 @@ use super::*;
use crate::pac::cordic::vals;
/// Cordic instance
pub trait Instance {
pub(super) trait SealedInstance {
/// Get access to CORDIC registers
fn regs() -> crate::pac::cordic::Cordic;