From a61bf90c17bb68ee7f1c599366f15b1efbd85795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 26 May 2016 18:33:08 +0200 Subject: [PATCH] Adding docs --- signer/src/lib.rs | 2 ++ signer/src/types/bytes.rs | 23 ++++++----------------- signer/src/types/mod.rs.in | 1 + signer/src/types/transaction_request.rs | 10 ++++++++++ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/signer/src/lib.rs b/signer/src/lib.rs index ed8ec12ce..d8e7f63ec 100644 --- a/signer/src/lib.rs +++ b/signer/src/lib.rs @@ -17,6 +17,8 @@ #![warn(missing_docs)] #![cfg_attr(all(nightly, feature="dev"), feature(plugin))] #![cfg_attr(all(nightly, feature="dev"), plugin(clippy))] +// Generated by serde +#![cfg_attr(all(nightly, feature="dev"), allow(redundant_closure_call))] //! Signer module //! diff --git a/signer/src/types/bytes.rs b/signer/src/types/bytes.rs index aa2772894..d8896f849 100644 --- a/signer/src/types/bytes.rs +++ b/signer/src/types/bytes.rs @@ -14,27 +14,13 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -// Copyright 2015, 2016 Ethcore (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - use rustc_serialize::hex::ToHex; use serde::{Serialize, Serializer, Deserialize, Deserializer, Error}; use serde::de::Visitor; use util::common::FromHex; +///! Serializable wrapper around vector of bytes + /// Wrapper structure around vector of bytes. #[derive(Debug, PartialEq, Eq, Default, Hash, Clone)] pub struct Bytes(pub Vec); @@ -44,7 +30,10 @@ impl Bytes { pub fn new(bytes: Vec) -> Bytes { Bytes(bytes) } - pub fn to_vec(self) -> Vec { let Bytes(x) = self; x } + /// Convert back to vector + pub fn to_vec(self) -> Vec { + let Bytes(x) = self; x + } } impl Serialize for Bytes { diff --git a/signer/src/types/mod.rs.in b/signer/src/types/mod.rs.in index 7040780f3..8e9befa4f 100644 --- a/signer/src/types/mod.rs.in +++ b/signer/src/types/mod.rs.in @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +///! Reusable types with JSON Serialization. pub mod transaction_request; pub mod bytes; diff --git a/signer/src/types/transaction_request.rs b/signer/src/types/transaction_request.rs index f95d7ff4c..83840515b 100644 --- a/signer/src/types/transaction_request.rs +++ b/signer/src/types/transaction_request.rs @@ -14,19 +14,29 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +//! `TransactionRequest` type + use util::hash::Address; use util::numbers::U256; use types::bytes::Bytes; +/// Transaction request coming from RPC #[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Deserialize)] pub struct TransactionRequest { + /// Sender pub from: Address, + /// Recipient pub to: Option
, + /// Gas Price #[serde(rename="gasPrice")] pub gas_price: Option, + /// Gas pub gas: Option, + /// Value of transaction in wei pub value: Option, + /// Additional data sent with transaction pub data: Option, + /// Transaction's nonce pub nonce: Option, }