Trait RegMapPtr

Source
pub unsafe trait RegMapPtr<'a>: Sized + 'a {
    type RegMap;

    // Required methods
    unsafe fn from_nonnull(ptr: NonNull<Self::RegMap>) -> Self;
    unsafe fn from_ptr(ptr: *mut Self::RegMap) -> Self;
    fn from_mut(reg: &'a mut Self::RegMap) -> Self;
    fn as_ptr(&self) -> *mut Self::RegMap;
}
Expand description

Pointers to custom register maps derived by RegMap.

⚠️ This trait is implemented by the derive macro RegMap. Do not implement this trait directly. Adding new required items to this trait is not considered semver breaking.

§Safety

This trait should only be implemented through the derive macro RegMap.

Required Associated Types§

Required Methods§

Source

unsafe fn from_nonnull(ptr: NonNull<Self::RegMap>) -> Self

Creates a new pointer to Self::RegMap.

§Safety
  • ptr must point to a valid instance of Self::RegMap;
  • ptr must be valid for the whole lifetime 'a;
  • all fields of Self::RegMap must allow volatile reads/writes.
Source

unsafe fn from_ptr(ptr: *mut Self::RegMap) -> Self

Creates a new pointer to Self::RegMap.

§Safety
  • ptr must not be null;
  • ptr must point to a valid instance of Self::RegMap;
  • ptr must be valid for the whole lifetime 'a;
  • all fields of Self::RegMap must allow volatile reads/writes.
Source

fn from_mut(reg: &'a mut Self::RegMap) -> Self

Return a pointer to Self::RegMap from a mutable (exclusive) reference.

Source

fn as_ptr(&self) -> *mut Self::RegMap

Returns a raw pointer to the underlying register map.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§