/// Clones the buffer, copying the valid portion of it from the
/// source. The non-valid part of the result has undefined
/// contents which may be different from the source.
Clones the buffer, copying the valid portion of it from the
source. The non-valid part of the result has undefined
contents which may be different from the source.
Clones the buffer copying the valid portion of it from the source . The non - valid part of the result has undefined contents which may be different from the source .
fn clone(&self) -> AlignedBuf {
        assert!(self.valid <= self.len);
        unsafe {
            match AlignedBuf::alloc_uninit(self.len, self.align) {
                None => panic!("clone failed"),
                Some(mut b) => {
                    if b.valid > 0 {
                        ptr::copy_nonoverlapping(self.buf as *const u8, b.buf, b.valid);
                        b.valid = self.valid
                    };
                    b
                }
            }
        }
    }
fn clone ( & self ) -> AlignedBuf { assert ! ( self valid self len ) ; unsafe { match AlignedBuf :: alloc_uninit ( self . len , self . align ) { None => panic ! ( " " ) , Some ( mut b ) => { if b . valid > 0 { ptr :: copy_nonoverlapping ( self . buf as * const u8 , b . buf , b . valid ) ; b . valid = self . valid } ; b } } } }
Clones the buffer, copying the valid portion of it from the
source.
Clones the buffer copying the valid portion of it from the source .
&self