Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,25 @@ impl Drop for Job {
}

impl<'a> Buffers<'a> {
#[allow(trivial_casts)]
pub fn new(in_buf: &'a [u8], out_buf: &'a mut [u8], eof_in: bool) -> Self {
Buffers {
inner: raw::rs_buffers_t {
next_in: in_buf.as_ptr() as *const i8,
next_in: in_buf.as_ptr() as *const libc::c_char,
avail_in: in_buf.len(),
eof_in: if eof_in { 1 } else { 0 },
next_out: out_buf.as_mut_ptr() as *mut i8,
next_out: out_buf.as_ptr() as *mut libc::c_char,
avail_out: out_buf.len(),
},
_phantom: PhantomData,
}
}

#[allow(trivial_casts)]
pub fn with_no_out(in_buf: &'a [u8], eof_in: bool) -> Self {
Buffers {
inner: raw::rs_buffers_t {
next_in: in_buf.as_ptr() as *const i8,
next_in: in_buf.as_ptr() as *const libc::c_char,
avail_in: in_buf.len(),
eof_in: if eof_in { 1 } else { 0 },
next_out: ptr::null_mut(),
Expand Down