use std::ffi::c_void;
use libc::iovec;
use crate::iobuf::PlatformIoBuf;
pub type IoBuf = iovec;
impl PlatformIoBuf for IoBuf {
#[inline]
fn new(ptr: *mut u8, len: usize) -> Self {
iovec {
iov_base: ptr as *mut c_void,
iov_len: len,
}
}
#[inline]
fn len(&self) -> usize {
self.iov_len
}
#[inline]
fn ptr(&self) -> *mut u8 {
self.iov_base as *mut u8
}
#[inline]
fn set_len(&mut self, len: usize) {
self.iov_len = len;
}
#[inline]
fn set_ptr(&mut self, ptr: *mut u8) {
self.iov_base = ptr as *mut c_void;
}
}