Documentation.

This commit is contained in:
Gav Wood 2015-12-07 17:20:15 +01:00
parent 5a889a35be
commit 03674cad3b
4 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,5 @@
//! General error types for use in ethcore.
use rustc_serialize::hex::*; use rustc_serialize::hex::*;
#[derive(Debug)] #[derive(Debug)]
@ -6,6 +8,7 @@ pub enum BaseDataError {
} }
#[derive(Debug)] #[derive(Debug)]
/// General error type which should be capable of representing all errors in ethcore.
pub enum EthcoreError { pub enum EthcoreError {
FromHex(FromHexError), FromHex(FromHexError),
BaseData(BaseDataError), BaseData(BaseDataError),

View File

@ -1,3 +1,5 @@
//! General hash types, a fixed-size raw-data type used as the output of hash functions.
use std::str::FromStr; use std::str::FromStr;
use std::fmt; use std::fmt;
use std::ops; use std::ops;
@ -11,7 +13,9 @@ use bytes::BytesConvertable;
use math::log2; use math::log2;
use uint::U256; use uint::U256;
/// types implementing FixedHash must be also BytesConvertable /// Trait for a fixed-size byte array to be used as the output of hash functions.
///
/// Note: types implementing `FixedHash` must be also `BytesConvertable`.
pub trait FixedHash: Sized + BytesConvertable { pub trait FixedHash: Sized + BytesConvertable {
fn new() -> Self; fn new() -> Self;
fn random() -> Self; fn random() -> Self;

View File

@ -1,7 +1,9 @@
//! Database of byte-slices keyed to their Keccak hash.
use hash::*; use hash::*;
use bytes::*; use bytes::*;
use std::collections::HashMap; use std::collections::HashMap;
/// Trait modelling datastore keyed by a 32-byte Keccak hash.
pub trait HashDB { pub trait HashDB {
/// Get the keys in the database together with number of underlying references. /// Get the keys in the database together with number of underlying references.
fn keys(&self) -> HashMap<H256, i32>; fn keys(&self) -> HashMap<H256, i32>;

View File

@ -1,3 +1,4 @@
//! Key-value datastore with a modified Merkle tree.
extern crate rand; extern crate rand;
use std::fmt; use std::fmt;