-
Notifications
You must be signed in to change notification settings - Fork 433
Add binding for git_message_trailers
#749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
15a7d4e
5575c3d
33ebdcd
f6fd4b7
b0015cc
e94008a
e830f7d
55ea909
e7b0306
cd4c2db
e450945
a0bd026
34fa7b5
023fb92
16321f3
70b7ebd
ed11c76
958e378
2508506
f35b68f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
std::marker any more
See: #749 (comment)
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| use core::ops::Range; | ||
| use std::ffi::CStr; | ||
| use std::ffi::CString; | ||
| use std::marker; | ||
| use std::ptr; | ||
|
|
||
| use libc::{c_char, c_int}; | ||
|
|
@@ -37,7 +36,6 @@ fn _message_prettify(message: CString, comment_char: Option<u8>) -> Result<Strin | |
| /// Use `iter()` to get access to the values. | ||
| pub struct MessageTrailers { | ||
| raw: raw::git_message_trailer_array, | ||
| _marker: marker::PhantomData<c_char>, | ||
| } | ||
|
|
||
| impl MessageTrailers { | ||
|
|
@@ -80,7 +78,6 @@ impl Binding for MessageTrailers { | |
| unsafe fn from_raw(raw: *mut raw::git_message_trailer_array) -> MessageTrailers { | ||
| MessageTrailers { | ||
| raw: *raw, | ||
| _marker: marker::PhantomData, | ||
| } | ||
| } | ||
| fn raw(&self) -> *mut raw::git_message_trailer_array { | ||
|
|
@@ -100,15 +97,14 @@ impl<'pair> Iterator for MessageTrailersIterator<'pair> { | |
| fn next(&mut self) -> Option<Self::Item> { | ||
| self.range | ||
| .next() | ||
| .map(|index| to_str_tuple(&self.trailers, index, marker::PhantomData)) | ||
| .map(|index| to_str_tuple(&self.trailers, index)) | ||
| } | ||
| } | ||
|
|
||
| #[inline(always)] | ||
|
||
| fn to_str_tuple( | ||
| trailers: &MessageTrailers, | ||
| index: usize, | ||
| _marker: marker::PhantomData<c_char>, | ||
| ) -> (&str, &str) { | ||
| unsafe { | ||
| let addr = trailers.raw.trailers.wrapping_add(index); | ||
|
|
@@ -128,7 +124,7 @@ impl DoubleEndedIterator for MessageTrailersIterator<'_> { | |
| fn next_back(&mut self) -> Option<Self::Item> { | ||
| self.range | ||
| .next_back() | ||
| .map(|index| to_str_tuple(&self.trailers, index, marker::PhantomData)) | ||
| .map(|index| to_str_tuple(&self.trailers, index)) | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add implementations for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I implemented The doc says that See rev. e7b0306 |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add
size_hinthere too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay I think I understand now. I confused myself thought that
size_hint()was part ofExactSizeIterator.See rev 16321f3