# Trait ethcore::db::Readable [−] [src]

    pub trait Readable {
        fn read<T, R>(&self, col: Option<u32>, key: &Key<T, Target=R>) -> Option<T> where T: Decodable, R: Deref<Target=[u8]>;
        fn exists<T, R>(&self, col: Option<u32>, key: &Key<T, Target=R>) -> bool where R: Deref<Target=[u8]>;

        fn read_with_cache<K, T, C>(&self,
                                col: Option<u32>,
                                cache: &RwLock<C>,
                                key: &K)
                                -> Option<T> where K: Key<T> + Eq + Hash + Clone, T: Clone + Decodable, C: Cache<K, T> { ... }
        fn exists_with_cache<K, T, R, C>(&self,
                                     col: Option<u32>,
                                     cache: &RwLock<C>,
                                     key: &K)
                                     -> bool where K: Eq + Hash + Key<T, Target=R>, R: Deref<Target=[u8]>, C: Cache<K, T> { ... }
    }

Should be used to read values from database.

## Required Methods

### `fn read<T, R>(&self, col: Option<u32>, key: &Key<T, Target=R>) -> Option<T> where T: Decodable, R: Deref<Target=[u8]>`

Returns value for given key.

### `fn exists<T, R>(&self, col: Option<u32>, key: &Key<T, Target=R>) -> bool where R: Deref<Target=[u8]>`

Returns true if given value exists.

## Provided Methods

### `fn read_with_cache<K, T, C>(&self,
col: Option<u32>,
cache: &RwLock<C>,
key: &K)
-> Option<T> where K: Key<T> + Eq + Hash + Clone, T: Clone + Decodable, C: Cache<K, T>`

Returns value for given key either in cache or in database.

### `fn exists_with_cache<K, T, R, C>(&self,
col: Option<u32>,
cache: &RwLock<C>,
key: &K)
-> bool where K: Eq + Hash + Key<T, Target=R>, R: Deref<Target=[u8]>, C: Cache<K, T>`

Returns true if given value exists either in cache or in database.

## Implementors

- `impl Readable for Database`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)