[][src]Struct mohan::hash::H256

pub struct H256(_);

A hash to uniquely (or close enough) identify one of the main blockchain constructs. Used pervasively for blocks, transactions and outputs.

Methods

impl H256[src]

pub fn zero() -> H256[src]

pub fn hash_with<T: Writeable>(&self, other: T) -> H256[src]

pub fn from_vec(v: &[u8]) -> H256[src]

Builds a Hash from a byte vector. If the vector is too short, it will be completed by zeroes. If it's too long, it will be truncated.

pub fn to_vec(&self) -> Vec<u8>[src]

Converts the hash to a byte vector

pub fn as_bytes(&self) -> &[u8][src]

Returns a byte slice of the hash contents.

pub fn to_bytes(&self) -> [u8; 32][src]

Returns a byte slice of the hash contents.

pub fn to_hex(&self) -> String[src]

Convert a hash to hex string format.

pub fn from_hex(hex: &str) -> Result<H256, Error>[src]

Convert hex string back to hash.

pub fn to_u64(&self) -> u64[src]

Most significant 64 bits

pub fn into_scalar(&self) -> Scalar[src]

Convert Hash into a Scalar

pub fn to_uint(&self) -> U256[src]

Flip into u256

Trait Implementations

impl Add<H256> for H256[src]

type Output = H256

The resulting type after applying the + operator.

impl AsRef<[u8]> for H256[src]

impl Clone for H256[src]

impl Copy for H256[src]

impl Debug for H256[src]

impl Default for H256[src]

impl DefaultHashable for H256[src]

impl<'de> Deserialize<'de> for H256[src]

impl Display for H256[src]

impl Eq for H256[src]

impl FixedLength for H256[src]

const LEN: usize[src]

Size of a hash in bytes.

impl From<[u8; 32]> for H256[src]

impl FromStr for H256[src]

type Err = Error

The associated error which can be returned from parsing.

fn from_str(input: &str) -> Result<H256, Error>[src]

Creates a hash type instance from the given string.

impl Hash for H256[src]

impl Index<Range<usize>> for H256[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFrom<usize>> for H256[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for H256[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeTo<usize>> for H256[src]

type Output = [u8]

The returned type after indexing.

impl Index<usize> for H256[src]

type Output = u8

The returned type after indexing.

impl Ord for H256[src]

impl PartialEq<H256> for H256[src]

impl PartialOrd<H256> for H256[src]

impl Readable for H256[src]

impl Serialize for H256[src]

impl StructuralEq for H256[src]

impl StructuralPartialEq for H256[src]

impl Writeable for H256[src]

Auto Trait Implementations

impl RefUnwindSafe for H256

impl Send for H256

impl Sync for H256

impl Unpin for H256

impl UnwindSafe for H256

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromBits<T> for T

impl<T> FromCast<T> for T

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<M> Measure for M where
    M: Debug + PartialOrd<M> + Add<M, Output = M> + Default + Clone
[src]

impl<N> NodeTrait for N where
    N: Copy + Ord + Hash
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,