Skip to content

Commit 28587c6

Browse files
committed
[object #177] tag::RefIter -> TagRefIter
1 parent 7e701ce commit 28587c6

File tree

18 files changed

+308
-316
lines changed

18 files changed

+308
-316
lines changed

git-object/src/blob.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use crate::Blob;
2-
use crate::BlobRef;
1+
use std::{convert::Infallible, io};
32

4-
use std::convert::Infallible;
5-
use std::io;
3+
use crate::{Blob, BlobRef};
64

75
impl Blob {
86
/// Write the blobs data to `out` verbatim.

git-object/src/immutable/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@ pub mod commit;
1010
///
1111
pub mod object;
1212

13-
///
14-
pub mod tag;
15-
1613
pub(crate) mod parse;

git-object/src/immutable/tag.rs

Lines changed: 0 additions & 277 deletions
This file was deleted.

git-object/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use std::borrow::Cow;
99
pub use bstr;
1010
use bstr::{BStr, BString, ByteSlice};
1111
use smallvec::SmallVec;
12-
12+
use tree::Entry;
1313
pub use types::{Error, Kind};
1414

1515
use crate::tree::EntryRef;
16-
use tree::Entry;
1716

1817
pub mod immutable;
1918
pub mod mutable;
@@ -117,6 +116,13 @@ pub struct TagRef<'a> {
117116
pub pgp_signature: Option<&'a BStr>,
118117
}
119118

119+
/// Like [`TagRef`], but as `Iterator` to support entirely allocation free parsing.
120+
/// It's particularly useful to dereference only the target chain.
121+
pub struct TagRefIter<'a> {
122+
data: &'a [u8],
123+
state: tag::ref_iter::State,
124+
}
125+
120126
/// A mutable git tag.
121127
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
122128
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]

git-object/src/mutable/object.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ impl Object {
6060
mod convert {
6161
use std::convert::TryFrom;
6262

63-
use crate::Object;
64-
use crate::{Blob, Commit, Tag, Tree};
63+
use crate::{Blob, Commit, Object, Tag, Tree};
6564

6665
impl From<Tag> for Object {
6766
fn from(v: Tag) -> Self {

git-object/src/mutable/tag.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ use std::io;
33
use bstr::BStr;
44
use quick_error::quick_error;
55

6-
use crate::mutable::{encode, NL};
7-
use crate::Tag;
6+
use crate::{
7+
mutable::{encode, NL},
8+
Tag,
9+
};
810

911
quick_error! {
1012
/// An Error used in [`Tag::write_to()`].

git-object/src/tag.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)