[][src]Struct flatdata::MemoryResourceStorage

pub struct MemoryResourceStorage { /* fields omitted */ }

Resource storage in memory.

Can be used to create archives in-memory, e.g. when writing tests.

Examples

let storage = MemoryResourceStorage::new("/root/extvec");
let _builder = XBuilder::new(storage.clone()).expect("failed to create builder");
// Write some data

let _archive = X::open(storage).expect("failed to open");
// read some data

Methods

impl MemoryResourceStorage[src]

pub fn new<P: Into<PathBuf>>(path: P) -> Rc<Self>[src]

Create an empty memory resource storage at a given virtual path.

Resources will be placed in ephemeral memory with prefix path. A path has to be provided to unify the interface with FileResourceStorage.

Trait Implementations

impl ResourceStorage for MemoryResourceStorage[src]

fn read(
    &self,
    resource_name: &str,
    schema: &str
) -> Result<&[u8], ResourceStorageError>
[src]

Open a flatdata resource with given name and schema for reading. Read more

fn write(&self, resource_name: &str, schema: &str, data: &[u8]) -> Result<()>[src]

Writes data of a flatdata resource with given name and schema to storage. Read more

fn read_and_check_schema(
    &self,
    resource_name: &str,
    expected_schema: &str
) -> Result<&[u8], ResourceStorageError>
[src]

Implementation helper for [read]. Read more

impl Debug for MemoryResourceStorage[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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]