/// Create a static version of this buffer
///
/// If the current buffer is borrowed, this will copy the data
Create a static version of this buffer
If the current buffer is borrowed, this will copy the data
Create a static version of this buffer If the current buffer is borrowed this will copy the data
pub fn to_owned(&self) -> BitReadBuffer<'static, E> {
        let bytes = self.bytes.to_owned();
        let byte_len = bytes.len();
        // this is safe because
        //  - the slice can only be access trough this struct
        //  - this struct keeps the vec the slice comes from alive
        //  - this struct doesn't allow mutation
        let slice = unsafe { std::slice::from_raw_parts(bytes.as_slice().as_ptr(), bytes.len()) };
        BitReadBuffer {
            bytes,
            bit_len: byte_len * 8,
            endianness: PhantomData,
            slice,
        }
    }
pub fn to_owned ( & self ) -> BitReadBuffer < ' static , E > { let bytes = self . bytes . to_owned ( ) ; let byte_len = bytes . len ( ) ; // this is safe because //  - the slice can only be access trough this struct //  - this struct keeps the vec the slice comes from alive //  - this struct doesn't allow mutation let slice = unsafe { std :: slice :: from_raw_parts ( bytes . as_slice ( ) . as_ptr ( ) , bytes . len ( ) ) } ; BitReadBuffer { bytes , bit_len : byte_len * 8 , endianness : PhantomData , slice , } }
Create a static version of this buffer
If the current buffer is borrowed, this will copy the data
Create a static version of this buffer If the current buffer is borrowed this will copy the data
&self