Struct imxrt_ral::Instance

source ·
pub struct Instance<T, const N: u8> { /* private fields */ }
Expand description

An owned peripheral of type T, instance N.

Fabricating an Instance is always unsafe. An owner of an Instance may assume that

  • the underlying pointer points to a static register block of type T.
  • the instance number N properly describes the peripheral instance.
  • they own all registers pointed at by T.

Owners use this guarantee to safely access the peripheral registers. However, nothing guarantees any of these except for your diligence.

Constructing an Instance is zero cost. Additionally, Instance is transparent and amenable to null-pointer optimizations.

See the package-level documentation for more information on fabricating instances.

§Safety of new().

By calling new(), you claim

  1. ptr points to static memory that can be described by a type T.
  2. The instance number N correctly describes ptr.
  3. You are becoming the sole owner of this instance.

§Safety of instance()

The various instance() methods handle safety concerns 1 and 2 from new(). By their construction, each instance() implementation provides a pointer to valid peripheral memory, and associates the correct N with that pointer. Therefore, you’re only responsible for ensuring safety concern 3 from new().

Implementations§

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 5>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 3>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 4>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 3>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 1>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, 2>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl Instance<RegisterBlock, { crate::SOLE_INSTANCE }>

source

pub const unsafe fn instance() -> Self

Acquire a vaild, but possibly aliased, instance.

§Safety

See the struct-level safety documentation.

source§

impl<T, const N: u8> Instance<T, N>

source

pub const unsafe fn new(ptr: *const T) -> Self

Create an arbitrary Instance from a pointer to T.

§Safety

See the struct docs for the safety contract.

Trait Implementations§

source§

impl<T, const N: u8> Deref for Instance<T, N>

source§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T, const N: u8> Send for Instance<T, N>

Auto Trait Implementations§

§

impl<T, const N: u8> Freeze for Instance<T, N>

§

impl<T, const N: u8> RefUnwindSafe for Instance<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: u8> !Sync for Instance<T, N>

§

impl<T, const N: u8> Unpin for Instance<T, N>

§

impl<T, const N: u8> UnwindSafe for Instance<T, N>
where T: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.