pub unsafe fn write_struct<T>(&mut self, ix: usize, s: &T) {
        let len = mem::size_of::<T>();
        //println!("writing {} bytes at {}", len, ix);
        copy_nonoverlapping(
            s as *const T as *const u8,
            self.buf[ix..ix + len].as_mut_ptr(),
            len,
        );
    }
// It's probably better to do this without unsafety (after all, we're just creating bytes).
// Probably the thing to do is write proc macros.
It's probably better to do this without unsafety (after all, we're just creating bytes).
Probably the thing to do is write proc macros.
It ' s probably better to do this without unsafety ( after all we ' re just creating bytes ) . Probably the thing to do is write proc macros .
pub unsafe fn write_struct<T>(&mut self, ix: usize, s: &T) {
        let len = mem::size_of::<T>();
        //println!("writing {} bytes at {}", len, ix);
        copy_nonoverlapping(
            s as *const T as *const u8,
            self.buf[ix..ix + len].as_mut_ptr(),
            len,
        );
    }
pub unsafe fn write_struct < T > ( & mut self , ix : usize , s : & T ) { let len = mem :: size_of :: < T > ( ) ; //println!("writing {} bytes at {}", len, ix); copy_nonoverlapping ( s as * const T as * const u8 , self . buf [ ix .. ix + len ] . as_mut_ptr ( ) , len , ) ; }
It's probably better to do this without unsafety (after all, we're just creating bytes).
It ' s probably better to do this without unsafety ( after all we ' re just creating bytes ) .
&mut self
ix
usize
s
&T
&mut self
ix
usize
s
&T