Skip to content

Commit 737496d

Browse files
committed
feat: Add struct git_odb_stream and enum git_odb_stream_t
Added type definition for struct `libgit2-sys::git_odb_stream`. Previously incorrectly defined as an opaque enum. See git2/odb_backend.h line 196. Added type definition for enum `git_odb_stream_t`. I believe it corresponds to the `mode` field of `git_odb_stream`, but that's just a guess. See git2/odb_backend.h line 182.
1 parent ae91c48 commit 737496d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

libgit2-sys/lib.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,28 @@ pub enum git_reflog_entry {}
8787
pub enum git_describe_result {}
8888
pub enum git_packbuilder {}
8989
pub enum git_odb {}
90-
pub enum git_odb_stream {}
90+
91+
#[repr(C)]
92+
pub struct git_odb_stream {
93+
pub backend: *mut git_odb_backend,
94+
pub mode: c_uint,
95+
pub hash_ctx: *mut c_void,
96+
pub declared_size: git_object_size_t,
97+
pub received_bytes: git_object_size_t,
98+
pub read: Option<extern "C" fn(*mut git_odb_stream, *mut c_char, size_t) -> c_int>,
99+
pub write: Option<extern "C" fn(*mut git_odb_stream, *const c_char, size_t) -> c_int>,
100+
pub finalize_write: Option<extern "C" fn(*mut git_odb_stream, *const git_oid) -> c_int>,
101+
pub free: Option<extern "C" fn(*mut git_odb_stream)>
102+
}
103+
104+
git_enum! {
105+
pub enum git_odb_stream_t: c_int {
106+
GIT_STREAM_RDONLY = 2,
107+
GIT_STREAM_WRONLY = 4,
108+
GIT_STREAM_RW = 6,
109+
}
110+
}
111+
91112
pub enum git_odb_object {}
92113
pub enum git_worktree {}
93114
pub enum git_transaction {}

0 commit comments

Comments
 (0)