Created
January 5, 2017 01:32
-
-
Save cholcombe973/46f520c508ddb9d95c49209155503543 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn write_async<F>(&self, | |
file_handle: *mut Struct_glfs_fd, | |
buffer: &[u8], | |
flags: i32, | |
callback: F, | |
data: &mut ::libc::c_void) | |
-> Result<(), GlusterError> | |
where F: Fn(*mut Struct_glfs_fd, isize, *mut ::libc::c_void) | |
{ | |
let closure = Closure3::new(&callback); | |
let callback_ptr = closure.code_ptr(); | |
unsafe { | |
let ret_code = glfs_write_async(file_handle, | |
buffer.as_ptr() as *const c_void, | |
buffer.len(), | |
flags, | |
Some(*callback_ptr), | |
data); | |
if ret_code < 0 { | |
return Err(GlusterError::new(get_error())); | |
} | |
} | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment