Struct storage_proofs_core::data::Data[][src]

pub struct Data<'a> { /* fields omitted */ }

A wrapper around data either on disk or a slice in memory, that can be dropped and read back into memory, to allow for better control of memory consumption.

Implementations

impl<'a> Data<'a>[src]

pub fn from_path(path: PathBuf) -> Self[src]

pub fn new(raw: &'a mut [u8], path: PathBuf) -> Self[src]

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

pub fn ensure_data(&mut self) -> Result<()>[src]

Recover the data.

pub fn drop_data(&mut self)[src]

Drops the actual data, if we can recover it.

Trait Implementations

impl<'a> AsMut<[u8]> for Data<'a>[src]

fn as_mut(&mut self) -> &mut [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Performs the conversion.

impl<'a> AsRef<[u8]> for Data<'a>[src]

fn as_ref(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Performs the conversion.

impl<'a> Debug for Data<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a> From<&'a mut [u8]> for Data<'a>[src]

fn from(raw: &'a mut [u8]) -> Self[src]

Performs the conversion.

impl<'a> From<(MmapMut, PathBuf)> for Data<'a>[src]

fn from(raw: (MmapMut, PathBuf)) -> Self[src]

Performs the conversion.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Data<'a>

impl<'a> Send for Data<'a>

impl<'a> Sync for Data<'a>

impl<'a> Unpin for Data<'a>

impl<'a> !UnwindSafe for Data<'a>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T, U> AsByteSlice<T> for U where
    U: AsRef<[T]> + ?Sized,
    T: ToByteSlice, 

pub fn as_byte_slice(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]

impl<T, U> AsMutByteSlice<T> for U where
    U: AsMut<[T]> + ?Sized,
    T: ToMutByteSlice, 

pub fn as_mut_byte_slice(&mut self) -> &mut [u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]

impl<U> AsMutSliceOf for U where
    U: AsMut<[u8]> + ?Sized

pub fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error> where
    T: FromByteSlice, 

impl<U> AsSliceOf for U where
    U: AsRef<[u8]> + ?Sized

pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
    T: FromByteSlice, 

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

pub fn encode_hex<U>(&self) -> U where
    U: FromIterator<char>, 
[src]

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

pub fn encode_hex_upper<U>(&self) -> U where
    U: FromIterator<char>, 
[src]

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V