Skip to content

Commit

Permalink
Remove Registry::new.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Jan 22, 2021
1 parent 638f33d commit eaa5896
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ path = "src/cargo/lib.rs"
atty = "0.2"
bytesize = "1.0"
cargo-platform = { path = "crates/cargo-platform", version = "0.1.1" }
crates-io = { path = "crates/crates-io", version = "0.31.1" }
crates-io = { path = "crates/crates-io", version = "0.33.0" }
crossbeam-utils = "0.8"
crypto-hash = "0.3.1"
curl = { version = "0.4.23", features = ["http2"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/crates-io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crates-io"
version = "0.31.1"
version = "0.33.0"
edition = "2018"
authors = ["Alex Crichton <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand Down
17 changes: 13 additions & 4 deletions crates/crates-io/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,19 @@ struct Crates {
meta: TotalCrates,
}
impl Registry {
pub fn new(host: String, token: Option<String>) -> Registry {
Registry::new_handle(host, token, Easy::new())
}

/// Creates a new `Registry`.
///
/// ## Example
///
/// ```rust
/// use curl::easy::Easy;
/// use crates_io::Registry;
///
/// let mut handle = Easy::new();
/// // If connecting to crates.io, a user-agent is required.
/// handle.useragent("my_crawler (example.com/info)");
/// let mut reg = Registry::new_handle(String::from("https://crates.io"), None, handle);
/// ```
pub fn new_handle(host: String, token: Option<String>, handle: Easy) -> Registry {
Registry {
host,
Expand Down

0 comments on commit eaa5896

Please sign in to comment.