Skip to main content

HramArea

Struct HramArea 

Source
pub struct HramArea<const N: usize>(/* private fields */);
Expand description

A raw, fixed-size region of High RAM, addressed through pointers.

The home for a routine that must execute from HRAM (an OAM DMA trampoline) or a scratch buffer. Declare it with hram!. HRAM is NOLOAD, so the runtime zero-initialises it at startup; fill it at runtime.

Implementations§

Source§

impl<const N: usize> HramArea<N>

Source

pub const unsafe fn uninit() -> HramArea<N>

Reserve an area.

§Safety

The area must come to rest in High RAM (0xFF80..=0xFFFE); hram! guarantees this.

Source

pub const fn as_ptr(&self) -> *const u8

A pointer to the start of the area.

Source

pub const fn as_mut_ptr(&self) -> *mut u8

A mutable pointer to the start of the area.

Source

pub const fn as_array_ptr(&self) -> *mut [u8; N]

A mutable pointer to the area as a fixed-size byte array.

Source

pub const fn len(&self) -> usize

The area’s length in bytes (N).

Source

pub const fn is_empty(&self) -> bool

Whether the area is zero bytes.

Trait Implementations§

Source§

impl<const N: usize> Sync for HramArea<N>

Auto Trait Implementations§

§

impl<const N: usize> !Freeze for HramArea<N>

§

impl<const N: usize> !RefUnwindSafe for HramArea<N>

§

impl<const N: usize> BankSafe for HramArea<N>

§

impl<const N: usize> Send for HramArea<N>

§

impl<const N: usize> Unpin for HramArea<N>

§

impl<const N: usize> UnsafeUnpin for HramArea<N>

§

impl<const N: usize> UnwindSafe for HramArea<N>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.