[−][src]Struct ckb_rocksdb::DBVector
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,