nimiq-database 0.2.0

A LMDB database wrapper with support for volatile storage
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::borrow::Cow;
use std::io;

use nimiq_keys::Address;

use crate::{AsDatabaseBytes, FromDatabaseValue};

impl AsDatabaseBytes for Address {
    fn as_database_bytes(&self) -> Cow<[u8]> {
        Cow::Borrowed(self.as_bytes())
    }
}

impl FromDatabaseValue for Address {
    fn copy_from_database(bytes: &[u8]) -> io::Result<Self> where Self: Sized {
        Ok(bytes.into())
    }
}