Fix indentation in URL loaders

This commit is contained in:
Keegan McAllister 2013-10-09 12:30:40 -07:00
parent 05901f8761
commit cb67a50a95
2 changed files with 22 additions and 22 deletions

View file

@ -10,23 +10,23 @@ use std::task;
static READ_SIZE: uint = 1024;
pub fn factory() -> LoaderTask {
let f: LoaderTask = |url, progress_chan| {
assert!("file" == url.scheme);
do task::spawn {
// FIXME: Resolve bug prevents us from moving the path out of the URL.
match file_reader(&Path(url.path)) {
Ok(reader) => {
while !reader.eof() {
let data = reader.read_bytes(READ_SIZE);
progress_chan.send(Payload(data));
}
progress_chan.send(Done(Ok(())));
}
Err(*) => {
progress_chan.send(Done(Err(())));
}
};
}
};
f
let f: LoaderTask = |url, progress_chan| {
assert!("file" == url.scheme);
do task::spawn {
// FIXME: Resolve bug prevents us from moving the path out of the URL.
match file_reader(&Path(url.path)) {
Ok(reader) => {
while !reader.eof() {
let data = reader.read_bytes(READ_SIZE);
progress_chan.send(Payload(data));
}
progress_chan.send(Done(Ok(())));
}
Err(*) => {
progress_chan.send(Done(Err(())));
}
};
}
};
f
}

View file

@ -13,12 +13,12 @@ use http::headers::HeaderEnum;
use std::rt::io::Reader;
pub fn factory() -> LoaderTask {
let f: LoaderTask = |url, progress_chan| {
let f: LoaderTask = |url, progress_chan| {
let url = Cell::new(url);
let progress_chan = Cell::new(progress_chan);
spawn(|| load(url.take(), progress_chan.take()))
};
f
};
f
}
fn load(url: Url, progress_chan: Chan<ProgressMsg>) {