pub struct Stack<const N: usize> { /* private fields */ }Expand description
A stack you can use as your Process Stack (PSP)
The const-param N is the size in 32-bit words
Implementations§
Source§impl<const N: usize> Stack<N>
impl<const N: usize> Stack<N>
Sourcepub const fn new() -> Stack<N>
pub const fn new() -> Stack<N>
Const-initialise a Stack
Use a turbofish to specify the size, like:
static PSP_STACK: Stack::<4096> = Stack::new();
fn example() {
let handle = PSP_STACK.take_handle();
// ...
}Sourcepub fn take_handle(&self) -> StackHandle
pub fn take_handle(&self) -> StackHandle
Return the top of the stack
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> !Freeze for Stack<N>
impl<const N: usize> !RefUnwindSafe for Stack<N>
impl<const N: usize> Send for Stack<N>
impl<const N: usize> Unpin for Stack<N>
impl<const N: usize> UnsafeUnpin for Stack<N>
impl<const N: usize> UnwindSafe for Stack<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more