diff --git a/util/src/heapsizeof.rs b/util/src/heapsizeof.rs index c6d4cace4..8dcc53728 100644 --- a/util/src/heapsizeof.rs +++ b/util/src/heapsizeof.rs @@ -1,3 +1,5 @@ +//! Calculates heapsize of util types. + use uint::*; use hash::*; diff --git a/util/src/lib.rs b/util/src/lib.rs index 622fc950b..64cbac662 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -8,30 +8,55 @@ //! Ethcore-util library //! //! ### Rust version: -//! - beta //! - nightly //! //! ### Supported platforms: //! - OSX //! - Linux //! -//! ### Dependencies: -//! - RocksDB 3.13 +//! ### Building: //! -//! ### Dependencies Installation: +//! - Ubuntu 14.04 and later: //! +//! ```bash +//! # install rocksdb +//! add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" +//! apt-get update +//! apt-get install -y --force-yes librocksdb +//! +//! # install multirust +//! curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes +//! +//! # install nightly and make it default +//! multirust update nightly && multirust default nightly +//! +//! # export rust LIBRARY_PATH +//! export LIBRARY_PATH=/usr/local/lib +//! +//! # download and build parity +//! git clone https://github.com/ethcore/parity +//! cd parity +//! cargo build --release +//! ``` +//! //! - OSX: //! //! ```bash +//! # install rocksdb && multirust +//! brew update //! brew install rocksdb -//! ``` +//! brew install multirust //! -//! - From source: +//! # install nightly and make it default +//! multirust update nightly && multirust default nightly //! -//! ```bash -//! wget https://github.com/facebook/rocksdb/archive/rocksdb-3.13.tar.gz -//! tar xvf rocksdb-3.13.tar.gz && cd rocksdb-rocksdb-3.13 && make shared_lib -//! sudo make install +//! # export rust LIBRARY_PATH +//! export LIBRARY_PATH=/usr/local/lib +//! +//! # download and build parity +//! git clone https://github.com/ethcore/parity +//! cd parity +//! cargo build --release //! ``` extern crate slab; @@ -89,8 +114,7 @@ pub mod triehash; /// TODO [Gav Wood] Please document me pub mod trie; pub mod nibbleslice; -/// TODO [Gav Wood] Please document me -pub mod heapsizeof; +mod heapsizeof; pub mod squeeze; /// TODO [Gav Wood] Please document me pub mod semantic_version; @@ -114,7 +138,6 @@ pub use crypto::*; pub use triehash::*; pub use trie::*; pub use nibbleslice::*; -pub use heapsizeof::*; pub use squeeze::*; pub use semantic_version::*; pub use network::*; diff --git a/util/src/vector.rs b/util/src/vector.rs index 94b5ee70c..b9770e30b 100644 --- a/util/src/vector.rs +++ b/util/src/vector.rs @@ -1,40 +1,4 @@ -//! vector util functions - -use std::ptr; - -/// TODO [debris] Please document me -pub trait InsertSlice { - /// TODO [debris] Please document me - fn insert_slice(&mut self, index: usize, elements: &[T]); -} - -/// based on `insert` function implementation from standard library -impl InsertSlice for Vec { - fn insert_slice(&mut self, index: usize, elements: &[T]) { - let e_len = elements.len(); - if e_len == 0 { - return; - } - - let len = self.len(); - assert!(index <= len); - - // space for the new element - self.reserve(e_len); - - unsafe { - { - let p = self.as_mut_ptr().offset(index as isize); - let ep = elements.as_ptr().offset(0); - // shift everything by e_len, to make space - ptr::copy(p, p.offset(e_len as isize), len - index); - // write new element - ptr::copy(ep, p, e_len); - } - self.set_len(len + e_len); - } - } -} +//! Vector extensions. /// Returns len of prefix shared with elem ///