make map_struct functions public
This commit is contained in:
		@ -13,14 +13,14 @@ use std::os::unix::io::AsRawFd;
 | 
			
		||||
 | 
			
		||||
pub mod timer;
 | 
			
		||||
 | 
			
		||||
fn map_struct<T>(buffer: &[u8]) -> Result<&T, Error> {
 | 
			
		||||
pub fn map_struct<T>(buffer: &[u8]) -> Result<&T, Error> {
 | 
			
		||||
    if buffer.len() < ::std::mem::size_of::<T>() {
 | 
			
		||||
        bail!("unable to map struct - buffer too small");
 | 
			
		||||
    }
 | 
			
		||||
    return Ok(unsafe { & * (buffer.as_ptr() as *const T) });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn map_struct_mut<T>(buffer: &mut [u8]) -> Result<&mut T, Error> {
 | 
			
		||||
pub fn map_struct_mut<T>(buffer: &mut [u8]) -> Result<&mut T, Error> {
 | 
			
		||||
    if buffer.len() < ::std::mem::size_of::<T>() {
 | 
			
		||||
        bail!("unable to map struct - buffer too small");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user