util docs
This commit is contained in:
parent
6ec672a1a6
commit
2bddc938af
@ -1,3 +1,5 @@
|
|||||||
|
//! Ethcore crypto.
|
||||||
|
|
||||||
use hash::*;
|
use hash::*;
|
||||||
use bytes::*;
|
use bytes::*;
|
||||||
use uint::*;
|
use uint::*;
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
/// General IO module.
|
//! General IO module.
|
||||||
///
|
//!
|
||||||
/// Example usage for craeting a network service and adding an IO handler:
|
//! Example usage for craeting a network service and adding an IO handler:
|
||||||
///
|
//!
|
||||||
/// ```rust
|
//! ```rust
|
||||||
/// extern crate ethcore_util;
|
//! extern crate ethcore_util;
|
||||||
/// use ethcore_util::*;
|
//! use ethcore_util::*;
|
||||||
///
|
//!
|
||||||
/// struct MyHandler;
|
//! struct MyHandler;
|
||||||
///
|
//!
|
||||||
/// #[derive(Clone)]
|
//! #[derive(Clone)]
|
||||||
/// struct MyMessage {
|
//! struct MyMessage {
|
||||||
/// data: u32
|
//! data: u32
|
||||||
/// }
|
//! }
|
||||||
///
|
//!
|
||||||
/// impl IoHandler<MyMessage> for MyHandler {
|
//! impl IoHandler<MyMessage> for MyHandler {
|
||||||
/// fn initialize(&self, io: &IoContext<MyMessage>) {
|
//! fn initialize(&self, io: &IoContext<MyMessage>) {
|
||||||
/// io.register_timer(0, 1000).unwrap();
|
//! io.register_timer(0, 1000).unwrap();
|
||||||
/// }
|
//! }
|
||||||
///
|
//!
|
||||||
/// fn timeout(&self, _io: &IoContext<MyMessage>, timer: TimerToken) {
|
//! fn timeout(&self, _io: &IoContext<MyMessage>, timer: TimerToken) {
|
||||||
/// println!("Timeout {}", timer);
|
//! println!("Timeout {}", timer);
|
||||||
/// }
|
//! }
|
||||||
///
|
//!
|
||||||
/// fn message(&self, _io: &IoContext<MyMessage>, message: &MyMessage) {
|
//! fn message(&self, _io: &IoContext<MyMessage>, message: &MyMessage) {
|
||||||
/// println!("Message {}", message.data);
|
//! println!("Message {}", message.data);
|
||||||
/// }
|
//! }
|
||||||
/// }
|
//! }
|
||||||
///
|
//!
|
||||||
/// fn main () {
|
//! fn main () {
|
||||||
/// let mut service = IoService::<MyMessage>::start().expect("Error creating network service");
|
//! let mut service = IoService::<MyMessage>::start().expect("Error creating network service");
|
||||||
/// service.register_handler(Arc::new(MyHandler)).unwrap();
|
//! service.register_handler(Arc::new(MyHandler)).unwrap();
|
||||||
///
|
//!
|
||||||
/// // Wait for quit condition
|
//! // Wait for quit condition
|
||||||
/// // ...
|
//! // ...
|
||||||
/// // Drop the service
|
//! // Drop the service
|
||||||
/// }
|
//! }
|
||||||
/// ```
|
//! ```
|
||||||
mod service;
|
mod service;
|
||||||
mod worker;
|
mod worker;
|
||||||
|
|
||||||
|
@ -92,32 +92,24 @@ pub mod hash;
|
|||||||
pub mod uint;
|
pub mod uint;
|
||||||
pub mod bytes;
|
pub mod bytes;
|
||||||
pub mod rlp;
|
pub mod rlp;
|
||||||
/// TODO [Gav Wood] Please document me
|
|
||||||
pub mod misc;
|
pub mod misc;
|
||||||
/// TODO [Gav Wood] Please document me
|
mod json_aid;
|
||||||
pub mod json_aid;
|
|
||||||
pub mod vector;
|
pub mod vector;
|
||||||
pub mod sha3;
|
pub mod sha3;
|
||||||
pub mod hashdb;
|
pub mod hashdb;
|
||||||
pub mod memorydb;
|
pub mod memorydb;
|
||||||
pub mod overlaydb;
|
pub mod overlaydb;
|
||||||
pub mod journaldb;
|
pub mod journaldb;
|
||||||
/// TODO [Gav Wood] Please document me
|
mod math;
|
||||||
pub mod math;
|
|
||||||
pub mod chainfilter;
|
pub mod chainfilter;
|
||||||
/// TODO [Gav Wood] Please document me
|
|
||||||
pub mod crypto;
|
pub mod crypto;
|
||||||
pub mod triehash;
|
pub mod triehash;
|
||||||
/// TODO [Gav Wood] Please document me
|
|
||||||
pub mod trie;
|
pub mod trie;
|
||||||
pub mod nibbleslice;
|
pub mod nibbleslice;
|
||||||
mod heapsizeof;
|
mod heapsizeof;
|
||||||
pub mod squeeze;
|
pub mod squeeze;
|
||||||
/// TODO [Gav Wood] Please document me
|
|
||||||
pub mod semantic_version;
|
pub mod semantic_version;
|
||||||
/// TODO [Gav Wood] Please document me
|
|
||||||
pub mod io;
|
pub mod io;
|
||||||
/// TODO [Gav Wood] Please document me
|
|
||||||
pub mod network;
|
pub mod network;
|
||||||
pub mod log;
|
pub mod log;
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
/// log2
|
//! Common math functions.
|
||||||
|
|
||||||
|
/// Returns log2.
|
||||||
pub fn log2(x: usize) -> u32 {
|
pub fn log2(x: usize) -> u32 {
|
||||||
if x <= 1 {
|
if x <= 1 {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! Diff misc.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
|
|
||||||
#[derive(Debug,Clone,PartialEq,Eq)]
|
#[derive(Debug,Clone,PartialEq,Eq)]
|
||||||
|
@ -1,52 +1,53 @@
|
|||||||
/// Network and general IO module.
|
//! Network and general IO module.
|
||||||
/// Example usage for craeting a network service and adding an IO handler:
|
//!
|
||||||
///
|
//! Example usage for craeting a network service and adding an IO handler:
|
||||||
/// ```rust
|
//!
|
||||||
/// extern crate ethcore_util as util;
|
//! ```rust
|
||||||
/// use util::*;
|
//! extern crate ethcore_util as util;
|
||||||
///
|
//! use util::*;
|
||||||
/// struct MyHandler;
|
//!
|
||||||
///
|
//! struct MyHandler;
|
||||||
/// #[derive(Clone)]
|
//!
|
||||||
/// struct MyMessage {
|
//! #[derive(Clone)]
|
||||||
/// data: u32
|
//! struct MyMessage {
|
||||||
/// }
|
//! data: u32
|
||||||
///
|
//! }
|
||||||
/// impl NetworkProtocolHandler<MyMessage> for MyHandler {
|
//!
|
||||||
/// fn initialize(&self, io: &NetworkContext<MyMessage>) {
|
//! impl NetworkProtocolHandler<MyMessage> for MyHandler {
|
||||||
/// io.register_timer(0, 1000);
|
//! fn initialize(&self, io: &NetworkContext<MyMessage>) {
|
||||||
/// }
|
//! io.register_timer(0, 1000);
|
||||||
///
|
//! }
|
||||||
/// fn read(&self, io: &NetworkContext<MyMessage>, peer: &PeerId, packet_id: u8, data: &[u8]) {
|
//!
|
||||||
/// println!("Received {} ({} bytes) from {}", packet_id, data.len(), peer);
|
//! fn read(&self, io: &NetworkContext<MyMessage>, peer: &PeerId, packet_id: u8, data: &[u8]) {
|
||||||
/// }
|
//! println!("Received {} ({} bytes) from {}", packet_id, data.len(), peer);
|
||||||
///
|
//! }
|
||||||
/// fn connected(&self, io: &NetworkContext<MyMessage>, peer: &PeerId) {
|
//!
|
||||||
/// println!("Connected {}", peer);
|
//! fn connected(&self, io: &NetworkContext<MyMessage>, peer: &PeerId) {
|
||||||
/// }
|
//! println!("Connected {}", peer);
|
||||||
///
|
//! }
|
||||||
/// fn disconnected(&self, io: &NetworkContext<MyMessage>, peer: &PeerId) {
|
//!
|
||||||
/// println!("Disconnected {}", peer);
|
//! fn disconnected(&self, io: &NetworkContext<MyMessage>, peer: &PeerId) {
|
||||||
/// }
|
//! println!("Disconnected {}", peer);
|
||||||
///
|
//! }
|
||||||
/// fn timeout(&self, io: &NetworkContext<MyMessage>, timer: TimerToken) {
|
//!
|
||||||
/// println!("Timeout {}", timer);
|
//! fn timeout(&self, io: &NetworkContext<MyMessage>, timer: TimerToken) {
|
||||||
/// }
|
//! println!("Timeout {}", timer);
|
||||||
///
|
//! }
|
||||||
/// fn message(&self, io: &NetworkContext<MyMessage>, message: &MyMessage) {
|
//!
|
||||||
/// println!("Message {}", message.data);
|
//! fn message(&self, io: &NetworkContext<MyMessage>, message: &MyMessage) {
|
||||||
/// }
|
//! println!("Message {}", message.data);
|
||||||
/// }
|
//! }
|
||||||
///
|
//! }
|
||||||
/// fn main () {
|
//!
|
||||||
/// let mut service = NetworkService::<MyMessage>::start(NetworkConfiguration::new()).expect("Error creating network service");
|
//! fn main () {
|
||||||
/// service.register_protocol(Arc::new(MyHandler), "myproto", &[1u8]);
|
//! let mut service = NetworkService::<MyMessage>::start(NetworkConfiguration::new()).expect("Error creating network service");
|
||||||
///
|
//! service.register_protocol(Arc::new(MyHandler), "myproto", &[1u8]);
|
||||||
/// // Wait for quit condition
|
//!
|
||||||
/// // ...
|
//! // Wait for quit condition
|
||||||
/// // Drop the service
|
//! // ...
|
||||||
/// }
|
//! // Drop the service
|
||||||
/// ```
|
//! }
|
||||||
|
//! ```
|
||||||
mod host;
|
mod host;
|
||||||
mod connection;
|
mod connection;
|
||||||
mod handshake;
|
mod handshake;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! Semantic version formatting and comparing.
|
||||||
|
|
||||||
/// A version value with strict meaning. Use `to_u32` to convert to a simple integer.
|
/// A version value with strict meaning. Use `to_u32` to convert to a simple integer.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! Trie interface and implementation.
|
||||||
|
|
||||||
/// TODO [Gav Wood] Please document me
|
/// TODO [Gav Wood] Please document me
|
||||||
pub mod trietraits;
|
pub mod trietraits;
|
||||||
pub mod standardmap;
|
pub mod standardmap;
|
||||||
|
Loading…
Reference in New Issue
Block a user