pub fn shrink(&mut self, size: usize) -> bool {
        let sz = (size + self.align - 1) & (self.align - 1);
        assert!(sz <= self.len);

        unsafe {
            let p = realloc(self.buf, self.len, sz, self.align);
            let ok = !p.is_null();

            if ok {
                self.buf = p;
                self.len = sz;
                self.valid = sz;
            };

            ok
        }
    }
/// Shrink a buffer. `size` is rounded up to the alignment.
Shrink a buffer. `size` is rounded up to the alignment.
Shrink a buffer . ` size ` is rounded up to the alignment .
pub fn shrink(&mut self, size: usize) -> bool {
        let sz = (size + self.align - 1) & (self.align - 1);
        assert!(sz <= self.len);
        unsafe {
            let p = realloc(self.buf, self.len, sz, self.align);
            let ok = !p.is_null();
            if ok {
                self.buf = p;
                self.len = sz;
                self.valid = sz;
            };
            ok
        }
    }
pub fn shrink ( & mut self , size : usize ) -> bool { let sz = ( size + self . align - 1 ) & ( self . align - 1 ) ; assert ! ( sz self len ) ; unsafe { let p = realloc ( self . buf , self . len , sz , self . align ) ; let ok = ! p . is_null ( ) ; if ok { self . buf = p ; self . len = sz ; self . valid = sz ; } ; ok } }
Shrink a buffer.
Shrink a buffer .
&mut self
size
usize
&mut self
size
usize