pub fn from_buf(vec: Vec<u8>) -> Result<Self, Vec<u8>> {
        if vec.capacity() < mem::size_of::<AtomicUsize>() {
            return Err(vec)
        }

        let vec_len = vec.len();
        let alloc_info = unsafe { AllocInfo::from_buf(vec) };

        Ok(AppendBuf {
            alloc: alloc_info,
            position: vec_len - mem::size_of::<AtomicUsize>()
        })
    }
/// Create an AppendBuf from an existing Vec.
///
/// The capacity of the AppendBuf is the capacity of the Vec with space extracted
/// at the beginning for the reference count. The reference count occupies the space
/// of a usize, and the Vec must have enough space for it.
///
/// If the Vec is too short, it is returned in the error value.
Create an AppendBuf from an existing Vec.
The capacity of the AppendBuf is the capacity of the Vec with space extracted
at the beginning for the reference count. The reference count occupies the space
of a usize, and the Vec must have enough space for it.

If the Vec is too short, it is returned in the error value.
Create an AppendBuf from an existing Vec . The capacity of the AppendBuf is the capacity of the Vec with space extracted at the beginning for the reference count . The reference count occupies the space of a usize and the Vec must have enough space for it . If the Vec is too short it is returned in the error value .
pub fn from_buf(vec: Vec<u8>) -> Result<Self, Vec<u8>> {
        if vec.capacity() < mem::size_of::<AtomicUsize>() {
            return Err(vec)
        }
        let vec_len = vec.len();
        let alloc_info = unsafe { AllocInfo::from_buf(vec) };
        Ok(AppendBuf {
            alloc: alloc_info,
            position: vec_len - mem::size_of::<AtomicUsize>()
        })
    }
pub fn from_buf ( vec : Vec < u8 > ) -> Result < Self , Vec < u8 > > { if vec . capacity ( ) < mem :: size_of :: < AtomicUsize > ( ) { return Err ( vec ) } let vec_len = vec . len ( ) ; let alloc_info = unsafe { AllocInfo :: from_buf ( vec ) } ; Ok ( AppendBuf { alloc : alloc_info , position : vec_len - mem :: size_of :: < AtomicUsize > ( ) } ) }
Create an AppendBuf from an existing Vec.
Create an AppendBuf from an existing Vec .
vec
Vec<u8>