mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Start sketching a net module
This commit is contained in:
parent
0761f306e6
commit
b281a508e0
3 changed files with 42 additions and 0 deletions
25
src/servo/net.rs
Normal file
25
src/servo/net.rs
Normal 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
13
src/servo/net/uri.rs
Normal 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
|
||||
}
|
|
@ -70,6 +70,10 @@ mod content {
|
|||
mod name_pool;
|
||||
}
|
||||
|
||||
mod net {
|
||||
mod uri;
|
||||
}
|
||||
|
||||
mod opts;
|
||||
mod engine;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue