Struct fixity::value::Addr[][src]

pub struct Addr(_);

Implementations

impl Addr[src]

pub const LEN: usize[src]

The length in bytes of an Addr.

pub fn hash<B: AsRef<[u8]>>(bytes: B) -> Self[src]

Hash the provided bytes and create an Addr of the bytes.

pub fn decode<S: AsRef<str>>(s: S) -> Option<Self>[src]

Create an Addr from a string of encoded bytes.

If the decoded bytes length does not match Addr::LEN, None is returned.

Example

let addr1 = Addr::hash("foo");
let addr2 = Addr::decode(addr1.long());
assert_eq!(Some(addr1), addr2);

Corrupt encodings return None.

let addr = Addr::decode("foo");
assert_eq!(addr, None);

Valid encodings but invalid byte lengths return None.

let encoded = multibase::encode(multibase::Base::Base58Btc, &[1,2,3,4]);
let addr = Addr::decode(encoded);
assert_eq!(addr, None);

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

Return a Base58Btc encoded Addr, in full.

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

Convert the underlying String into a byte slice.

Trait Implementations

impl AsRef<Addr> for Addr[src]

impl BorshDeserialize for Addr[src]

impl BorshSerialize for Addr[src]

impl Clone for Addr[src]

impl Debug for Addr[src]

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

impl Display for Addr[src]

impl Eq for Addr[src]

impl From<&'_ Addr> for Addr[src]

impl From<Addr> for Scalar[src]

impl Hash for Addr[src]

impl Ord for Addr[src]

impl PartialEq<Addr> for Addr[src]

impl PartialOrd<Addr> for Addr[src]

impl Serialize for Addr[src]

impl StructuralEq for Addr[src]

impl StructuralPartialEq for Addr[src]

impl TryFrom<Vec<u8, Global>> for Addr[src]

type Error = Vec<u8>

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Addr

impl Send for Addr

impl Sync for Addr

impl Unpin for Addr

impl UnwindSafe for Addr

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> Conv for T

impl<T> Conv for T

impl<T> Deserialize for T where
    T: BorshDeserialize + DeserializeOwned
[src]

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

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Serialize for T where
    T: BorshSerialize + Serialize
[src]

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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> TryConv for T

impl<T> TryConv for T

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.