[−][src]Struct mohan::hash::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.
fn add(self, other: H256) -> H256
[src]
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for H256
[src]
impl Eq for H256
[src]
impl FixedLength for H256
[src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<Range<usize>> for H256
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: Range<usize>) -> &[u8]
[src]
impl Index<RangeFrom<usize>> for H256
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: RangeFrom<usize>) -> &[u8]
[src]
impl Index<RangeFull> for H256
[src]
impl Index<RangeTo<usize>> for H256
[src]
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: RangeTo<usize>) -> &[u8]
[src]
impl Index<usize> for H256
[src]
impl Ord for H256
[src]
fn cmp(&self, other: &H256) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<H256> for H256
[src]
impl PartialOrd<H256> for H256
[src]
fn partial_cmp(&self, other: &H256) -> Option<Ordering>
[src]
fn lt(&self, other: &H256) -> bool
[src]
fn le(&self, other: &H256) -> bool
[src]
fn gt(&self, other: &H256) -> bool
[src]
fn ge(&self, other: &H256) -> bool
[src]
impl Readable for H256
[src]
impl Serialize for H256
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
U: FromCast<T>,
fn cast(self) -> U
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> FromBits<T> for T
fn from_bits(t: T) -> T
impl<T> FromCast<T> for T
fn from_cast(t: T) -> T
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> IntoBits<U> for T where
U: FromBits<T>,
U: FromBits<T>,
fn into_bits(self) -> U
impl<M> Measure for M where
M: Debug + PartialOrd<M> + Add<M, Output = M> + Default + Clone,
[src]
M: Debug + PartialOrd<M> + Add<M, Output = M> + Default + Clone,
impl<N> NodeTrait for N where
N: Copy + Ord + Hash,
[src]
N: Copy + Ord + Hash,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,