[][src]Struct ckb_rocksdb::DBVector

pub struct DBVector { /* fields omitted */ }

Vector of bytes stored in the database.

This is a C allocated byte array and a length value. Normal usage would be to utilize the fact it implements Deref<[u8]> and use it as a slice.

Methods

impl DBVector[src]

pub unsafe fn from_c(val: *mut u8, val_len: size_t) -> DBVector[src]

Used internally to create a DBVector from a C memory block

Unsafe

Requires that the ponter be allocated by a malloc derivative (all C libraries), and val_len be the length of the C array to be safe (since sizeof(u8) = 1).

Example

This example is not tested
let buf_len: libc::size_t = unsafe { mem::uninitialized() };
// Assume the function fills buf_len with the length of the returned array
let buf: *mut u8 = unsafe { ffi_function_returning_byte_array(&buf_len) };
DBVector::from_c(buf, buf_len)

pub fn to_utf8(&self) -> Option<&str>[src]

Convenience function to attempt to reinterperet value as string.

implemented as str::from_utf8(&self[..])

Trait Implementations

impl AsRef<[u8]> for DBVector[src]

impl Deref for DBVector[src]

type Target = [u8]

The resulting type after dereferencing.

impl Drop for DBVector[src]

Auto Trait Implementations

impl RefUnwindSafe for DBVector

impl !Send for DBVector

impl !Sync for DBVector

impl Unpin for DBVector

impl UnwindSafe for DBVector

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.