[][src]Struct slip132::KeyVersion

pub struct KeyVersion(_);

Structure holding 4 version bytes with magical numbers representing different versions of extended public and private keys according to BIP-32. Key version stores raw bytes without their check, interpretation or verification; for these purposes special helpers structures implementing VersionResolver are used.

Implementations

impl KeyVersion[src]

pub fn is_pub<R: VersionResolver>(&self) -> Option<bool>[src]

Detects whether provided version corresponds to an extended public key. Returns None if the version is not recognized/unknown to the resolver.

pub fn is_prv<R: VersionResolver>(&self) -> Option<bool>[src]

Detects whether provided version corresponds to an extended private key. Returns None if the version is not recognized/unknown to the resolver.

pub fn network<R: VersionResolver>(&self) -> Option<R::Network>[src]

Detects network used by the provided key version bytes. Returns None if the version is not recognized/unknown to the resolver.

pub fn application<R: VersionResolver>(&self) -> Option<R::Application>[src]

Detects application scope defined by the provided key version bytes. Application scope is a types of scriptPubkey descriptors in which given extended public/private keys can be used. Returns None if the version is not recognized/unknown to the resolver.

pub fn derivation_path<R: VersionResolver>(&self) -> Option<DerivationPath>[src]

Returns BIP 32 derivation path for the provided key version. Returns None if the version is not recognized/unknown to the resolver.

pub fn try_to_pub<R: VersionResolver>(&self) -> Option<KeyVersion>[src]

Converts version into version corresponding to an extended public key. Returns None if the resolver does not know how to perform conversion.

pub fn try_to_prv<R: VersionResolver>(&self) -> Option<KeyVersion>[src]

Converts version into version corresponding to an extended private key. Returns None if the resolver does not know how to perform conversion.

impl KeyVersion[src]

pub fn from_slice(version_slice: &[u8]) -> Option<KeyVersion>[src]

Tries to construct KeyVersion object from a byte slice. If byte slice length is not equal to 4, returns None

pub fn from_bytes(version_bytes: [u8; 4]) -> KeyVersion[src]

Constructs KeyVersion from a fixed 4 bytes values

pub fn from_u32(version: u32) -> KeyVersion[src]

Constructs KeyVersion from a u32-representation of the version bytes (the representation must be in bing endian format)

pub fn to_u32(&self) -> u32[src]

Converts version bytes into u32 representation in big endian format

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

Returns slice representing internal version bytes

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

Returns internal representation of version bytes

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

Constructs 4-byte array containing version byte values

pub fn into_bytes(self) -> [u8; 4][src]

Converts into 4-byte array containing version byte values

Trait Implementations

impl Clone for KeyVersion[src]

impl Copy for KeyVersion[src]

impl Debug for KeyVersion[src]

impl Eq for KeyVersion[src]

impl Hash for KeyVersion[src]

impl Ord for KeyVersion[src]

impl PartialEq<KeyVersion> for KeyVersion[src]

impl PartialOrd<KeyVersion> for KeyVersion[src]

impl StructuralEq for KeyVersion[src]

impl StructuralPartialEq for KeyVersion[src]

Auto Trait Implementations

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> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.