[][src]Struct hap::db::Database

pub struct Database { /* fields omitted */ }

Database is a wrapper type around a boxed implementor of the Storage trait.

Methods

impl Database[src]

pub fn new(storage: Box<dyn Storage + Send>) -> Database[src]

Creates a new Database.

pub fn new_with_file_storage(dir: &str) -> Result<Database, Error>[src]

Creates a new Database with a FileStorage as its Storage.

pub fn get_bytes(&self, key: &str) -> Result<Vec<u8>, Error>[src]

Returns the stored value for a given key as a Vec<u8>.

pub fn set_bytes(&self, key: &str, value: Vec<u8>) -> Result<(), Error>[src]

Stores a given Vec<u8> as the value for a given key.

pub fn get_device(&self) -> Result<Device, Error>[src]

Returns the stored Device.

pub fn set_device(&self, device: &Device) -> Result<(), Error>[src]

Stores the Device.

pub fn get_pairing(&self, id: Uuid) -> Result<Pairing, Error>[src]

Returns the stored Pairing for a given Uuid.

pub fn set_pairing(&self, pairing: &Pairing) -> Result<(), Error>[src]

Stores a given Pairing.

pub fn delete_pairing(&self, id: &Uuid) -> Result<(), Error>[src]

Deletes the stored Pairing for a given Uuid.

pub fn list_pairings(&self) -> Result<Vec<Pairing>, Error>[src]

Returns a Vec with all stored pairings.

pub fn count_pairings(&self) -> Result<usize, Error>[src]

Returns the number of stored pairings.

Auto Trait Implementations

impl Send for Database

impl !Sync for Database

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T