[−][src]Struct grin_core::core::hash::Hash
A hash to uniquely (or close enough) identify one of the main blockchain constructs. Used pervasively for blocks, transactions and outputs.
Methods
impl Hash
[src]
impl Hash
pub fn from_vec(v: &[u8]) -> Hash
[src]
pub fn from_vec(v: &[u8]) -> Hash
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]
pub fn to_vec(&self) -> Vec<u8>
Converts the hash to a byte vector
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Returns a byte slice of the hash contents.
pub fn to_hex(&self) -> String
[src]
pub fn to_hex(&self) -> String
Convert a hash to hex string format.
pub fn from_hex(hex: &str) -> Result<Hash, Error>
[src]
pub fn from_hex(hex: &str) -> Result<Hash, Error>
Convert hex string back to hash.
pub fn to_u64(&self) -> u64
[src]
pub fn to_u64(&self) -> u64
Most significant 64 bits
Trait Implementations
impl Writeable for Hash
[src]
impl Writeable for Hash
impl Readable for Hash
[src]
impl Readable for Hash
impl FixedLength for Hash
[src]
impl FixedLength for Hash
impl AsFixedBytes for Hash
[src]
impl AsFixedBytes for Hash
impl Ord for Hash
[src]
impl Ord for Hash
fn cmp(&self, other: &Hash) -> Ordering
[src]
fn cmp(&self, other: &Hash) -> Ordering
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialEq<Hash> for Hash
[src]
impl PartialEq<Hash> for Hash
impl Clone for Hash
[src]
impl Clone for Hash
fn clone(&self) -> Hash
[src]
fn clone(&self) -> Hash
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Hash
[src]
impl Copy for Hash
impl Eq for Hash
[src]
impl Eq for Hash
impl PartialOrd<Hash> for Hash
[src]
impl PartialOrd<Hash> for Hash
fn partial_cmp(&self, other: &Hash) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Hash) -> Option<Ordering>
fn lt(&self, other: &Hash) -> bool
[src]
fn lt(&self, other: &Hash) -> bool
fn le(&self, other: &Hash) -> bool
[src]
fn le(&self, other: &Hash) -> bool
fn gt(&self, other: &Hash) -> bool
[src]
fn gt(&self, other: &Hash) -> bool
fn ge(&self, other: &Hash) -> bool
[src]
fn ge(&self, other: &Hash) -> bool
impl AsRef<[u8]> for Hash
[src]
impl AsRef<[u8]> for Hash
impl Default for Hash
[src]
impl Default for Hash
impl Display for Hash
[src]
impl Display for Hash
impl Debug for Hash
[src]
impl Debug for Hash
impl Add<Hash> for Hash
[src]
impl Add<Hash> for Hash
type Output = Hash
The resulting type after applying the +
operator.
fn add(self, other: Hash) -> Hash
[src]
fn add(self, other: Hash) -> Hash
impl Index<usize> for Hash
[src]
impl Index<usize> for Hash
impl Index<Range<usize>> for Hash
[src]
impl Index<Range<usize>> for Hash
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: Range<usize>) -> &[u8]
[src]
fn index(&self, idx: Range<usize>) -> &[u8]
impl Index<RangeTo<usize>> for Hash
[src]
impl Index<RangeTo<usize>> for Hash
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: RangeTo<usize>) -> &[u8]
[src]
fn index(&self, idx: RangeTo<usize>) -> &[u8]
impl Index<RangeFrom<usize>> for Hash
[src]
impl Index<RangeFrom<usize>> for Hash
type Output = [u8]
The returned type after indexing.
fn index(&self, idx: RangeFrom<usize>) -> &[u8]
[src]
fn index(&self, idx: RangeFrom<usize>) -> &[u8]
impl Index<RangeFull> for Hash
[src]
impl Index<RangeFull> for Hash
impl Hash for Hash
[src]
impl Hash for Hash
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Serialize for Hash
[src]
impl Serialize for Hash
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
impl<'de> Deserialize<'de> for Hash
[src]
impl<'de> Deserialize<'de> for Hash
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<W> Hashed for W where
W: Writeable,
[src]
impl<W> Hashed for W where
W: Writeable,
impl<H> ShortIdentifiable for H where
H: Hashed,
[src]
impl<H> ShortIdentifiable for H where
H: Hashed,
fn short_id(&Self, &Hash, u64) -> ShortId
[src]
fn short_id(&Self, &Hash, u64) -> ShortId
Generate a short_id via the following -
- extract k0/k1 from block_hash hashed with the nonce (first two u64
values) * initialize a siphasher24 with k0/k1
- self.hash() passing in the siphasher24 instance
- drop the 2 most significant bytes (to return a 6 byte short_id)
impl<T> PMMRIndexHashable for T where
T: Writeable,
[src]
impl<T> PMMRIndexHashable for T where
T: Writeable,
fn hash_with_index(&Self, u64) -> Hash
[src]
fn hash_with_index(&Self, u64) -> Hash
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
impl<T> CloneAny for T where
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> Erased for T
impl<T> Erased for T
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self