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§
Sourceunsafe fn from_nonnull(ptr: NonNull<Self::RegMap>) -> Self
unsafe fn from_nonnull(ptr: NonNull<Self::RegMap>) -> Self
Creates a new pointer to Self::RegMap
.
§Safety
ptr
must point to a valid instance ofSelf::RegMap
;ptr
must be valid for the whole lifetime'a
;- all fields of
Self::RegMap
must allow volatile reads/writes.
Sourceunsafe fn from_ptr(ptr: *mut Self::RegMap) -> Self
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 ofSelf::RegMap
;ptr
must be valid for the whole lifetime'a
;- all fields of
Self::RegMap
must allow volatile reads/writes.
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.