Crate psm

source · []
Expand description

Portable Stack Manipulation

This crate provides portable functions to control the stack pointer and inspect the properties of the stack. This crate does not attempt to provide safe abstractions to any operations, the only goals are correctness, portability and efficiency (in that exact order). As a consequence most functions you will find in this crate are unsafe.

Note, that the stack allocation is left up to the user. Unless you’re writing a safe abstraction over stack manipulation, this is unlikely to be the crate you want. Instead consider one of the safe abstractions over this crate such as stacker. Another good place to look at is the’s reverse dependency list.


Macro that outputs its tokens only if psm::stack_pointer and psm::StackDirection::new are available.
Macro that outputs its tokens only if psm::on_stack and psm::replace_stack are available.


The direction into which stack grows as stack frames are made.


Run the closure on the provided stack.
Run the provided non-terminating computation on an entirely new stack.
Returns current stack pointer.