From 50ea43962ea5dfb64f4ce4089269e30ea9bbe1fd Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 28 Dec 2018 08:04:46 +0100 Subject: [PATCH] make map_struct functions public --- src/tools.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools.rs b/src/tools.rs index 6c22a62c..f752201e 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -13,14 +13,14 @@ use std::os::unix::io::AsRawFd; pub mod timer; -fn map_struct(buffer: &[u8]) -> Result<&T, Error> { +pub fn map_struct(buffer: &[u8]) -> Result<&T, Error> { if buffer.len() < ::std::mem::size_of::() { bail!("unable to map struct - buffer too small"); } return Ok(unsafe { & * (buffer.as_ptr() as *const T) }); } -fn map_struct_mut(buffer: &mut [u8]) -> Result<&mut T, Error> { +pub fn map_struct_mut(buffer: &mut [u8]) -> Result<&mut T, Error> { if buffer.len() < ::std::mem::size_of::() { bail!("unable to map struct - buffer too small"); }