Skip to content

Commit 092c4e6

Browse files
committed
Rename the crate to "url".
1 parent d66150a commit 092c4e6

File tree

4 files changed

+18
-27
lines changed

4 files changed

+18
-27
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ script:
1616
after_success: |
1717
[ $TRAVIS_BRANCH = master ] &&
1818
[ $TRAVIS_PULL_REQUEST = false ] &&
19-
find doc -type f | xargs sed -i 's|url_/|url/|g' &&
20-
mv doc/url_ doc/url &&
2119
echo '<meta http-equiv=refresh content=0;url=url/index.html>' > doc/index.html &&
2220
sudo pip install ghp-import &&
2321
ghp-import -n doc &&

Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ name = "url"
44
version = "0.1.0"
55
authors = [ "Simon Sapin <[email protected]>" ]
66

7-
[[lib]]
8-
9-
name = "url_"
10-
path = "src/url.rs"
11-
127
[dependencies.encoding]
138

149
git = "https://github.com/lifthrasiir/rust-encoding"

doc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/sh
2-
rustdoc src/url.rs -L target/deps -L target "$@"
2+
LIB=(target/liburl*)
3+
rustdoc src/lib.rs -L target/deps -L target --extern url=$LIB "$@"

src/url.rs renamed to src/lib.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
#![crate_name = "url_"]
10-
#![crate_type = "dylib"]
11-
#![crate_type = "rlib"]
9+
#![crate_name = "url"]
1210

1311
//! <a href="https://github.com/servo/rust-url"><img style="position: absolute; top: 0; left: 0; border: 0;" src="../github.png" alt="Fork me on GitHub"></a>
1412
//! <style>.sidebar { display: none }</style>
@@ -29,33 +27,29 @@
2927
//!
3028
//! rust-url is a replacement of the [`url` crate](http://doc.rust-lang.org/url/index.html)
3129
//! currently distributed with Rust.
32-
//! rust-url’s crate is currently named `url_` with an underscore to avoid a naming conflict,
33-
//! but the intent is to rename it to just `url` when the old crate eventually
34-
//! [goes away](https://github.com/rust-lang/rust/issues/15874).
35-
//! Therefore, it is recommended that you use this crate as follows:
30+
//! rust-url’s crate is also named `url`.
31+
//! Cargo will automatically resolve the name conflict,
32+
//! but that means that you can not also use the old `url` in the same crate.
3633
//!
37-
//! ```ignore
38-
//! extern crate url = "url_";
39-
//!
40-
//! use url::{Url, ...};
41-
//! ```
42-
//!
43-
//! That way, when the renaming is done, you will only need to change the `extern crate` line.
34+
//! If you’re not using Cargo, you’ll need to pass `--extern url=/path/to/liburl.rlib`
35+
//! explicitly to rustc.
4436
//!
4537
//!
4638
//! # URL parsing and data structures
4739
//!
4840
//! First, URL parsing may fail for various reasons and therefore returns a `Result`.
4941
//!
5042
//! ```
51-
//! # use url_::Url;
43+
//! use url::Url;
44+
//!
5245
//! assert!(Url::parse("http://[:::1]") == Err("Invalid IPv6 address"))
5346
//! ```
5447
//!
5548
//! Let’s parse a valid URL and look at its components.
5649
//!
5750
//! ```
58-
//! # use url_::{Url, RelativeSchemeData, NonRelativeSchemeData};
51+
//! use url::{Url, RelativeSchemeData, NonRelativeSchemeData};
52+
//!
5953
//! let issue_list_url = Url::parse(
6054
//! "https://github.com/rust-lang/rust/issues?labels=E-easy&state=open"
6155
//! ).unwrap();
@@ -81,7 +75,8 @@
8175
//! “in a relative scheme”. `https` is a relative scheme, but `data` is not:
8276
//!
8377
//! ```
84-
//! # use url_::{Url, NonRelativeSchemeData};
78+
//! use url::{Url, NonRelativeSchemeData};
79+
//!
8580
//! let data_url = Url::parse("data:text/plain,Hello#").unwrap();
8681
//!
8782
//! assert!(data_url.scheme == "data".to_string());
@@ -103,15 +98,17 @@
10398
//! Since parsed URL are absolute, giving a base is required:
10499
//!
105100
//! ```
106-
//! # use url_::Url;
101+
//! use url::Url;
102+
//!
107103
//! assert!(Url::parse("../main.css") == Err("Relative URL without a base"))
108104
//! ```
109105
//!
110106
//! `UrlParser` is a method-chaining API to provide various optional parameters
111107
//! to URL parsing, including a base URL.
112108
//!
113109
//! ```
114-
//! # use url_::{Url, UrlParser};
110+
//! use url::{Url, UrlParser};
111+
//!
115112
//! let this_document = Url::parse("http://servo.github.io/rust-url/url/index.html").unwrap();
116113
//! let css_url = UrlParser::new().base_url(&this_document).parse("../main.css").unwrap();
117114
//! assert!(css_url.serialize() == "http://servo.github.io/rust-url/main.css".to_string());

0 commit comments

Comments
 (0)