Start sketching a net module

This commit is contained in:
Brian Anderson 2012-05-24 14:36:25 -07:00
parent 0761f306e6
commit b281a508e0
3 changed files with 42 additions and 0 deletions

25
src/servo/net.rs Normal file
View file

@ -0,0 +1,25 @@
export uri, input_stream, channel, io_service, file_channel;
import uri::uri;
iface input_stream {
fn close();
fn read() -> [u8];
}
iface channel {
fn uri() -> uri;
fn open() -> input_stream;
}
iface io_service {
fn new_uri(spec: str) -> uri;
fn new_channel(uri: uri) -> channel;
}
class file_channel implements channel {
new() { }
fn uri() -> uri { fail }
fn open() -> input_stream { fail }
}

13
src/servo/net/uri.rs Normal file
View file

@ -0,0 +1,13 @@
export uri, build_uri;
type uri = {
spec: str,
scheme: str,
host: option<str>,
port: option<uint>,
path: str
};
fn build_uri(_spec: str) -> uri {
fail
}

View file

@ -70,6 +70,10 @@ mod content {
mod name_pool;
}
mod net {
mod uri;
}
mod opts;
mod engine;