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

View file

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