More doc updates. All Gav Wood docs done.

This commit is contained in:
Gav Wood
2016-02-03 14:51:45 +01:00
parent 3f03ba40ee
commit fad2f3a23d
20 changed files with 117 additions and 110 deletions

View File

@@ -60,20 +60,20 @@ macro_rules! panic_on_overflow {
}
}
/// TODO [Gav Wood] Please document me
/// Large, fixed-length unsigned integer type.
pub trait Uint: Sized + Default + FromStr + From<u64> + FromJson + fmt::Debug + fmt::Display + PartialOrd + Ord + PartialEq + Eq + Hash {
/// Size of this type.
const SIZE: usize;
/// TODO [Gav Wood] Please document me
/// Returns new instance equalling zero.
fn zero() -> Self;
/// TODO [Gav Wood] Please document me
/// Returns new instance equalling one.
fn one() -> Self;
/// TODO [Gav Wood] Please document me
/// Error type for converting from a decimal string.
type FromDecStrErr;
/// TODO [Gav Wood] Please document me
/// Convert from a decimal string.
fn from_dec_str(value: &str) -> Result<Self, Self::FromDecStrErr>;
/// Conversion to u32
@@ -105,25 +105,25 @@ pub trait Uint: Sized + Default + FromStr + From<u64> + FromJson + fmt::Debug +
fn overflowing_pow(self, other: Self) -> (Self, bool);
/// TODO [debris] Please document me
/// Overflowing addition operation.
fn overflowing_add(self, other: Self) -> (Self, bool);
/// TODO [debris] Please document me
/// Overflowing subtract operation.
fn overflowing_sub(self, other: Self) -> (Self, bool);
/// TODO [debris] Please document me
/// Overflowing multiply operation.
fn overflowing_mul(self, other: Self) -> (Self, bool);
/// TODO [debris] Please document me
/// Overflowing divide operation.
fn overflowing_div(self, other: Self) -> (Self, bool);
/// TODO [debris] Please document me
/// Overflowing remainder operation.
fn overflowing_rem(self, other: Self) -> (Self, bool);
/// TODO [debris] Please document me
/// Overflowing negative operation.
fn overflowing_neg(self) -> (Self, bool);
/// TODO [Gav Wood] Please document me
/// Overflowing left bit shift.
fn overflowing_shl(self, shift: u32) -> (Self, bool);
}
@@ -939,12 +939,10 @@ impl From<U256> for u32 {
}
}
/// TODO [Gav Wood] Please document me
/// Constant value of `U256::zero()` that can be used for a reference saving an additional instance creation.
pub const ZERO_U256: U256 = U256([0x00u64; 4]);
/// TODO [Gav Wood] Please document me
/// Constant value of `U256::one()` that can be used for a reference saving an additional instance creation.
pub const ONE_U256: U256 = U256([0x01u64, 0x00u64, 0x00u64, 0x00u64]);
/// TODO [Gav Wood] Please document me
pub const BAD_U256: U256 = U256([0xffffffffffffffffu64; 4]);
#[cfg(test)]
mod tests {