Closed
Description
The current implementation of the Url struct looks like this:
pub struct Url {
scheme: ~str,
user: Option<UserInfo>,
host: ~str,
port: Option<~str>,
path: ~str,
query: Query,
fragment: Option<~str>
}
It always has user, host, port, path and query fields, but those only exist for URLs with a relative scheme such as mailto
or data
. The data structure should be something like this:
pub struct Url {
scheme: ~str,
scheme_data: SchemeData,
fragment: Option<~str>
}
pub enum SchemeData {
RelativeSchemeData(RelativeSchemeData),
OtherSchemeData(~str),
}
pub struct RelativeSchemeData {
user: Option<UserInfo>,
host: ~str,
port: Option<~str>,
path: ~str,
query: Query,
}
Metadata
Metadata
Assignees
Labels
No labels