2015-04-16 18:08:44 +08:00
|
|
|
// Copyright (c) 2015, edef <edef@edef.eu>
|
|
|
|
// See the LICENSE file included in this distribution.
|
2015-04-16 11:37:17 +08:00
|
|
|
//! Traits for stacks.
|
|
|
|
|
|
|
|
/// A trait for objects that hold ownership of a stack.
|
2015-01-14 15:31:17 +08:00
|
|
|
pub trait Stack {
|
2015-04-16 11:37:17 +08:00
|
|
|
/// Returns the top of the stack.
|
|
|
|
/// On all modern architectures, the stack grows downwards,
|
|
|
|
/// so this is the highest address.
|
2015-01-14 15:31:17 +08:00
|
|
|
fn top(&mut self) -> *mut u8;
|
2015-04-16 11:37:17 +08:00
|
|
|
/// Returns the bottom of the stack.
|
|
|
|
/// On all modern architectures, the stack grows downwards,
|
|
|
|
/// so this is the lowest address.
|
2015-01-14 15:31:17 +08:00
|
|
|
fn limit(&self) -> *const u8;
|
2014-12-23 11:24:40 +08:00
|
|
|
}
|