let StackSource::get_stack take &mut self

This commit is contained in:
edef 2015-04-16 07:35:29 -04:00
parent 9bb0ce483d
commit bdb6e0bd8b
4 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ static mut ctx_slot: *mut Context<'static, lwkt::os::Stack> = 0 as *mut Context<
#[bench]
fn swap(b: &mut test::Bencher) {
unsafe {
let stack = lwkt::os::StackSource::get_stack(4 << 20).unwrap();
let stack = lwkt::os::StackSource.get_stack(4 << 20).unwrap();
let mut ctx = Context::new(stack, move || {
let ctx_ptr = ctx_slot;

View File

@ -7,7 +7,7 @@ static mut ctx_slot: *mut Context<'static, lwkt::os::Stack> = 0 as *mut Context<
fn main() {
unsafe {
let stack = lwkt::os::StackSource::get_stack(4 << 20).unwrap();
let stack = lwkt::os::StackSource.get_stack(4 << 20).unwrap();
let mut ctx = Context::new(stack, move || {
println!("it's alive!");

View File

@ -30,7 +30,7 @@ impl stack::StackSource for StackSource {
type Output = Stack;
type Error = IoError;
fn get_stack(size: usize) -> Result<Stack, IoError> {
fn get_stack(&mut self, size: usize) -> Result<Stack, IoError> {
let page_size = sys::page_size();
// round the page size up,

View File

@ -20,5 +20,5 @@ pub trait Stack {
pub trait StackSource {
type Output: Stack;
type Error: Debug + Display = ();
fn get_stack(size: usize) -> Result<Self::Output, Self::Error>;
fn get_stack(&mut self, size: usize) -> Result<Self::Output, Self::Error>;
}