[go: up one dir, main page]

[][src]Struct 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 Drop for DBVector[src]

impl Deref for DBVector[src]

type Target = [u8]

The resulting type after dereferencing.

Auto Trait Implementations

impl !Sync for DBVector

impl !Send for DBVector

impl Unpin for DBVector

impl RefUnwindSafe for DBVector

impl UnwindSafe for DBVector

Blanket Implementations

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.

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

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

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