add Context::destroy

This commit is contained in:
edef 2015-04-15 21:54:56 -04:00
parent 31652d7b8f
commit 7167b0b570
1 changed files with 6 additions and 2 deletions

View File

@ -4,7 +4,7 @@ use stack;
pub struct Context<Stack: stack::Stack> { pub struct Context<Stack: stack::Stack> {
regs: Registers, regs: Registers,
_stack: Stack stack: Stack
} }
impl<Stack> Context<Stack> where Stack: stack::Stack { impl<Stack> Context<Stack> where Stack: stack::Stack {
@ -14,7 +14,7 @@ impl<Stack> Context<Stack> where Stack: stack::Stack {
let regs = Registers::new(&mut stack, f); let regs = Registers::new(&mut stack, f);
Context { Context {
regs: regs, regs: regs,
_stack: stack stack: stack
} }
} }
@ -22,4 +22,8 @@ impl<Stack> Context<Stack> where Stack: stack::Stack {
pub unsafe fn swap(&mut self) { pub unsafe fn swap(&mut self) {
self.regs.swap() self.regs.swap()
} }
pub unsafe fn destroy(self) -> Stack {
self.stack
}
} }