/// Writes data to self.vec[offset..], wrapping around the end of the Vec if necessary. Returns
/// the number of bytes written.
Writes data to self.vec[offset..], wrapping around the end of the Vec if necessary. Returns
the number of bytes written.
Writes data to self . vec [ offset .. ] wrapping around the end of the Vec if necessary . Returns the number of bytes written .
fn wrapped_write(&self, offset: usize, mbufs: &[u64]) -> usize {
        let mut bytes: usize = 0;
        let ring_size = self.size();
        assert!(offset < ring_size);
        assert!(mbufs.len() <= ring_size);
        let mut bytes = min(ring_size - offset, mbufs.len());
        if bytes != 0 {
            unsafe{ ptr::copy(&mbufs[0] as (*const u64), self.vec.my_vec.offset(offset as isize), bytes) };
        }
        if offset + mbufs.len() > ring_size {
            let remaining = mbufs.len() - bytes;
            unsafe{ ptr::copy(((&mbufs[0]) as (*const u64)).offset(bytes as isize), self.vec.my_vec, remaining) };
            bytes += remaining;
        }
        bytes
    }
fn wrapped_write ( & self , offset : usize , mbufs : & [ u64 ] ) -> usize { let mut bytes : usize = 0 ; let ring_size = self . size ( ) ; assert ! ( offset ring_size ) ; assert ! ( mbufs len ( ) ring_size ) ; let mut bytes = min ( ring_size - offset , mbufs . len ( ) ) ; if bytes != 0 { unsafe { ptr :: copy ( & mbufs [ 0 ] as ( * const u64 ) , self . vec . my_vec . offset ( offset as isize ) , bytes ) } ; } if offset + mbufs . len ( ) > ring_size { let remaining = mbufs . len ( ) - bytes ; unsafe { ptr :: copy ( ( ( & mbufs [ 0 ] ) as ( * const u64 ) ) . offset ( bytes as isize ) , self . vec . my_vec , remaining ) } ; bytes += remaining ; } bytes }
Writes data to self.vec[offset..], wrapping around the end of the Vec if necessary.
Writes data to self . vec [ offset .. ] wrapping around the end of the Vec if necessary .
&self
offset
usize
mbufs
&[u64]