pub struct Hash160(/* private fields */);Expand description
A 20-byte script hash used to identify accounts and contracts on Neo N3.
Hash160 is the standard identifier for Neo addresses and contract script hashes. It wraps exactly 20 bytes and provides validated construction.
§Byte order
All Neo hashes (Hash160/Hash256) are stored and transmitted in
little-endian byte order, matching the Neo VM and on-wire protocol.
When converting from a display string (big-endian hex), the bytes are
reversed; the internal [u8; 20] is always little-endian.
Implementations§
Source§impl Hash160
impl Hash160
Sourcepub const fn from_bytes(bytes: [u8; 20]) -> Self
pub const fn from_bytes(bytes: [u8; 20]) -> Self
Creates a Hash160 from a 20-byte array.
Sourcepub fn try_from_slice(slice: &[u8]) -> NeoResult<Self>
pub fn try_from_slice(slice: &[u8]) -> NeoResult<Self>
Attempts to create a Hash160 from a byte slice.
Returns Err(NeoError::InvalidArgument) if the slice length is not exactly 20.
Sourcepub fn to_byte_string(&self) -> NeoByteString
pub fn to_byte_string(&self) -> NeoByteString
Converts this Hash160 into a NeoByteString.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hash160
impl<'de> Deserialize<'de> for Hash160
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Hash160
Source§impl From<Hash160> for NeoByteString
impl From<Hash160> for NeoByteString
impl StructuralPartialEq for Hash160
Source§impl TryFrom<NeoByteString> for Hash160
impl TryFrom<NeoByteString> for Hash160
Auto Trait Implementations§
impl Freeze for Hash160
impl RefUnwindSafe for Hash160
impl Send for Hash160
impl Sync for Hash160
impl Unpin for Hash160
impl UnsafeUnpin for Hash160
impl UnwindSafe for Hash160
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more