Skip to main content

ToBech32

Trait ToBech32 

Source
pub trait ToBech32 {
    // Required methods
    fn to_bech32(&self, hrp: &str) -> String;
    fn try_to_bech32(
        &self,
        hrp: &str,
        expected_hrp: Option<&str>,
    ) -> Result<String, Bech32Error>;
}

Required Methods§

Source

fn to_bech32(&self, hrp: &str) -> String

Encode secret bytes as Bech32 with the specified HRP.

Source

fn try_to_bech32( &self, hrp: &str, expected_hrp: Option<&str>, ) -> Result<String, Bech32Error>

Fallibly encode secret bytes as Bech32 with the specified HRP and optional expected HRP validation.

Implementors§

Source§

impl<T: AsRef<[u8]> + ?Sized> ToBech32 for T

Available on crate feature encoding-bech32 only.

Blanket impl to cover any AsRef<u8> (e.g., &[u8], Vec<u8>, [u8; N], etc.)