Skip to content

Commit 07f4b6c

Browse files
committed
change!: move CloneOptions into index module. (#16)
The `index` module is now public for that reason.
1 parent ecd84eb commit 07f4b6c

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/index.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,13 @@ use git2::{
66
Repository, Tree,
77
};
88
use std::str;
9+
use crate::Index;
910

1011
static INDEX_GIT_URL: &str = "https://github.com/rust-lang/crates.io-index";
1112
static LAST_SEEN_REFNAME: &str = "refs/heads/crates-index-diff_last-seen";
1213
static EMPTY_TREE_HASH: &str = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
1314
static LINE_ADDED_INDICATOR: char = '+';
1415

15-
/// A wrapper for a repository of the crates.io index.
16-
pub struct Index {
17-
/// The name and path of the reference used to keep track of the last seen state of the
18-
/// crates.io repository. The default value is `refs/heads/crates-index-diff_last-seen`.
19-
pub seen_ref_name: &'static str,
20-
/// The crates.io repository.
21-
repo: Repository,
22-
}
23-
2416
/// Options for use in `Index::from_path_or_cloned_with_options`
2517
pub struct CloneOptions<'a> {
2618
/// The url from which the repository should be cloned.

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#![forbid(missing_docs)]
66
#![deny(rust_2018_idioms)]
77

8-
mod index;
9-
mod version;
8+
///
9+
pub mod index;
10+
mod types;
1011

11-
pub use index::*;
12-
pub use version::*;
12+
pub use types::{Index, Change, Dependency, CrateVersion};
1313

1414
pub use git2;

src/version.rs renamed to src/types.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
use std::collections::HashMap;
22

33
use std::fmt;
4+
use git2::Repository;
5+
6+
/// A wrapper for a repository of the crates.io index.
7+
pub struct Index {
8+
/// The name and path of the reference used to keep track of the last seen state of the
9+
/// crates.io repository. The default value is `refs/heads/crates-index-diff_last-seen`.
10+
pub seen_ref_name: &'static str,
11+
/// The crates.io repository.
12+
pub(crate) repo: Repository,
13+
}
414

515
/// Identify a kind of change that occurred to a crate
616
#[derive(Clone, Eq, PartialEq, Debug)]

0 commit comments

Comments
 (0)