yamm-sys 0.1.1

YAMM(yet another memory mangement) rust binding
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]

pub use ffi::{Yamm,YammBuffer};


#[allow(clippy::all)]
mod ffi {

    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

    pub type YammBuffer = yamm_ns_yamm_buffer;
    pub type Yamm = yamm_ns_yamm;
    pub type YammAccess = yamm_ns_yamm_access;

    pub enum YammAllocationMode {
       RandomFit = 0,
       FirstFitRND = 1,
       BestFitRND = 2,
       FirstFit = 3,
       BestFit = 4,
       UniformFit = 5
    }

    pub enum YammDirection {
        YammRd = 0,
        YammWr = 1
    }

    pub type YammAddr = yamm_ns_uint_32_t;
    pub type YammSize = yamm_ns_uint_32_t;

    impl YammBuffer {
        #[inline]
        pub fn yamm_allocate_by_size(&mut self,size:YammSize,allocation_mode:YammAllocationMode) -> *mut YammBuffer {
            unsafe {
                self.allocate_by_size(size as u64,allocation_mode as i32)
            }
        }
        #[inline]
        pub fn yamm_allocate(&mut self,new_buffer: *mut YammBuffer,allocation_mode:YammAllocationMode) -> bool {
            unsafe {
                self.allocate(new_buffer,allocation_mode as i32)
                }
        }
        #[inline]
        pub fn new_with_size(size:YammSize) -> Self {
            unsafe {
                Self::new1(size as u64)
            }
        }
        #[inline]
        pub fn new_with_start_size(start:YammAddr,size:YammSize) -> Self {
            unsafe {
                Self::new2(start as u64,size as u64)
            }
        }
    }
}