fn load_buffers(&self, buffers: &[&[u8]]) -> Result<(), MagicError> {
        let mut ffi_buffers: Vec<*const u8> = Vec::with_capacity(buffers.len());
        let mut ffi_sizes: Vec<libc::size_t> = Vec::with_capacity(buffers.len());
        let ffi_nbuffers = buffers.len() as libc::size_t;

        for slice in buffers {
            ffi_buffers.push((*slice).as_ptr());
            ffi_sizes.push(slice.len() as libc::size_t);
        }

        if unsafe { magic_sys::magic_load_buffers(self.cookie, ffi_buffers.as_ptr(), ffi_sizes.as_ptr(), ffi_nbuffers) } == 0 {
            Ok(())
        } else {
            Err(self.magic_failure())
        }
    }
// Loads one or several buffers loaded with contents of compiled magic
// databases.  This function can be used in environments where the magic
// library doesn't have direct access to the filesystem.
Loads one or several buffers loaded with contents of compiled magic
databases.  This function can be used in environments where the magic
library doesn't have direct access to the filesystem.
Loads one or several buffers loaded with contents of compiled magic databases . This function can be used in environments where the magic library doesn ' t have direct access to the filesystem .
fn load_buffers(&self, buffers: &[&[u8]]) -> Result<(), MagicError> {
        let mut ffi_buffers: Vec<*const u8> = Vec::with_capacity(buffers.len());
        let mut ffi_sizes: Vec<libc::size_t> = Vec::with_capacity(buffers.len());
        let ffi_nbuffers = buffers.len() as libc::size_t;
        for slice in buffers {
            ffi_buffers.push((*slice).as_ptr());
            ffi_sizes.push(slice.len() as libc::size_t);
        }
        if unsafe { magic_sys::magic_load_buffers(self.cookie, ffi_buffers.as_ptr(), ffi_sizes.as_ptr(), ffi_nbuffers) } == 0 {
            Ok(())
        } else {
            Err(self.magic_failure())
        }
    }
fn load_buffers ( & self , buffers : & [ & [ u8 ] ] ) -> Result < ( ) , MagicError > { let mut ffi_buffers : Vec < * const u8 > = Vec :: with_capacity ( buffers . len ( ) ) ; let mut ffi_sizes : Vec < libc :: size_t > = Vec :: with_capacity ( buffers . len ( ) ) ; let ffi_nbuffers = buffers . len ( ) as libc :: size_t ; for slice in buffers { ffi_buffers . push ( ( * slice ) . as_ptr ( ) ) ; ffi_sizes . push ( slice . len ( ) as libc :: size_t ) ; } if unsafe { magic_sys :: magic_load_buffers ( self . cookie , ffi_buffers . as_ptr ( ) , ffi_sizes . as_ptr ( ) , ffi_nbuffers ) } == 0 { Ok ( ( ) ) } else { Err ( self . magic_failure ( ) ) } }
Loads one or several buffers loaded with contents of compiled magic
databases.
Loads one or several buffers loaded with contents of compiled magic databases .
&self
buffers
&[&[u8]]