From 5c252bdef55908779a3d45e57db355c907eb932f Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 15 Apr 2015 23:37:17 -0400 Subject: [PATCH] document Stack and StackSource --- src/stack.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/stack.rs b/src/stack.rs index 061a90f..59c92a8 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -1,8 +1,18 @@ +//! Traits for stacks. + +/// A trait for objects that hold ownership of a stack. pub trait Stack { + /// Returns the top of the stack. + /// On all modern architectures, the stack grows downwards, + /// so this is the highest address. fn top(&mut self) -> *mut u8; + /// Returns the bottom of the stack. + /// On all modern architectures, the stack grows downwards, + /// so this is the lowest address. fn limit(&self) -> *const u8; } +/// A trait for objects that provide stacks of arbitrary size. pub trait StackSource { type Output: Stack; fn get_stack(size: usize) -> Self::Output;