libgit: add higher-level libgit crate
The C functions exported by libgit-sys do not provide an idiomatic Rust interface. To make it easier to use these functions via Rust, add a higher-level "libgit" crate, that wraps the lower-level configset API with an interface that is more Rust-y. This combination of $X and $X-sys crates is a common pattern for FFI in Rust, as documented in "The Cargo Book" [1]. [1] https://doc.rust-lang.org/cargo/reference/build-scripts.html#-sys-packages Co-authored-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d76eb0dccc
commit
65c10aa8d5
@ -1,3 +1,5 @@
|
||||
use std::ffi::c_void;
|
||||
|
||||
#[cfg(has_std__ffi__c_char)]
|
||||
use std::ffi::{c_char, c_int};
|
||||
|
||||
@ -19,6 +21,8 @@ pub struct libgit_config_set {
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn free(ptr: *mut c_void);
|
||||
|
||||
pub fn libgit_user_agent() -> *const c_char;
|
||||
pub fn libgit_user_agent_sanitized() -> *const c_char;
|
||||
|
||||
|
Reference in New Issue
Block a user