[][src]Trait rustbreak::backend::Backend

pub trait Backend {
    fn get_data(&mut self) -> BackendResult<Vec<u8>>;
fn put_data(&mut self, data: &[u8]) -> BackendResult<()>; }

The Backend Trait.

It should always read and save in full the data that it is passed. This means that a write to the backend followed by a read must return the same dataset.

Important: You can only return custom errors if the other_errors feature is enabled

Required methods

fn get_data(&mut self) -> BackendResult<Vec<u8>>

Read the all data from the backend.

fn put_data(&mut self, data: &[u8]) -> BackendResult<()>

Write the whole slice to the backend.

Loading content...

Implementations on Foreign Types

impl Backend for Box<dyn Backend>[src]

impl<T: Backend> Backend for Box<T>[src]

Loading content...

Implementors

impl Backend for FileBackend[src]

impl Backend for MemoryBackend[src]

impl Backend for MmapStorage[src]

impl Backend for PathBackend[src]

fn put_data(&mut self, data: &[u8]) -> BackendResult<()>[src]

Write the byte slice to the backend. This uses and atomic save.

This won't corrupt the existing database file if the program panics during the save.

Loading content...