Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upadd Authority #15
add Authority #15
Conversation
|
What’s the use case? Do you want to use the Please describe what you’re trying to solve so we can discuss what API could solve it. I’d like to minimize the number of data structures in the public API. (It’s always easier to add stuff than to remove it.) |
|
Sure, makes sense. I felt it was easiest to write the code first. Url already provides getters for various parts, like host, port, etc. As for returning a Show, it felt right. It could return a String, but it |
|
Here is a possible refactoring, not merged yet: https://github.com/servo/rust-url/compare/textwriters You could use |
pub fn write_authority<W: TextWriter>(writer: &mut W, username: &str, password: Option<&str>,
host: &Host, port: Option<u16>) {
//...
}Calling that, such as |
|
Yes convenience methods/functions could be added on two axis:
… but it quickly gets messy if there is a separate method or function for every possible combinations. Which specific helpers do you think would be valuable? |
|
Many that already exist seemed useful, as well as an I found the Uri class in Android quite useful when developing for that platform. |
seanmonstar commentedAug 26, 2014