psrgbt

Trait KeyMap

Source
pub trait KeyMap: Sized {
    type Keys: KeyType;

    const PROPRIETARY_TYPE: Self::Keys;

    // Required methods
    fn retrieve_key_pair<'enc>(
        &'enc self,
        version: PsbtVer,
        key_type: Self::Keys,
    ) -> Vec<KeyPair<Self::Keys, Box<dyn Encode + 'enc>, Box<dyn Encode + 'enc>>>;
    fn insert_singular(
        &mut self,
        key_type: Self::Keys,
        value_data: ValueData,
    ) -> Result<(), PsbtError>;
    fn insert_plural(
        &mut self,
        key_type: Self::Keys,
        key_data: ByteStr,
        value_data: ValueData,
    ) -> Result<(), PsbtError>;

    // Provided methods
    fn encode_map(
        &self,
        version: PsbtVer,
        writer: &mut dyn Write,
    ) -> Result<usize, IoError> { ... }
    fn parse_map(
        &mut self,
        version: PsbtVer,
        map: Map<Self::Keys>,
    ) -> Result<(), PsbtError> { ... }
    fn has_proprietary(&self, key: &PropKey) -> bool { ... }
    fn proprietary(&self, key: &PropKey) -> Option<&ValueData> { ... }
    fn proprietary_mut(&mut self, key: &PropKey) -> Option<&mut ValueData> { ... }
    fn push_proprietary(
        &mut self,
        key: PropKey,
        value: impl Into<ValueData>,
    ) -> Result<(), KeyAlreadyPresent> { ... }
    fn remove_proprietary(&mut self, key: &PropKey) -> Option<ValueData> { ... }
    fn insert_proprietary(&mut self, prop_key: PropKey, value_data: ValueData) { ... }
    fn insert_unknown(
        &mut self,
        key_type: u8,
        key_data: ByteStr,
        value_data: ValueData,
    ) { ... }
}

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn retrieve_key_pair<'enc>( &'enc self, version: PsbtVer, key_type: Self::Keys, ) -> Vec<KeyPair<Self::Keys, Box<dyn Encode + 'enc>, Box<dyn Encode + 'enc>>>

Source

fn insert_singular( &mut self, key_type: Self::Keys, value_data: ValueData, ) -> Result<(), PsbtError>

Source

fn insert_plural( &mut self, key_type: Self::Keys, key_data: ByteStr, value_data: ValueData, ) -> Result<(), PsbtError>

Provided Methods§

Source

fn encode_map( &self, version: PsbtVer, writer: &mut dyn Write, ) -> Result<usize, IoError>

Source

fn parse_map( &mut self, version: PsbtVer, map: Map<Self::Keys>, ) -> Result<(), PsbtError>

Source

fn has_proprietary(&self, key: &PropKey) -> bool

Source

fn proprietary(&self, key: &PropKey) -> Option<&ValueData>

Source

fn proprietary_mut(&mut self, key: &PropKey) -> Option<&mut ValueData>

Source

fn push_proprietary( &mut self, key: PropKey, value: impl Into<ValueData>, ) -> Result<(), KeyAlreadyPresent>

Source

fn remove_proprietary(&mut self, key: &PropKey) -> Option<ValueData>

Source

fn insert_proprietary(&mut self, prop_key: PropKey, value_data: ValueData)

Source

fn insert_unknown( &mut self, key_type: u8, key_data: ByteStr, value_data: ValueData, )

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl KeyMap for Input

Source§

const PROPRIETARY_TYPE: <Input as KeyMap>::Keys = InputKey::Proprietary

Source§

type Keys = InputKey

Source§

impl KeyMap for Output

Source§

const PROPRIETARY_TYPE: <Output as KeyMap>::Keys = OutputKey::Proprietary

Source§

type Keys = OutputKey

Source§

impl KeyMap for Psbt

Source§

const PROPRIETARY_TYPE: <Psbt as KeyMap>::Keys = GlobalKey::Proprietary

Source§

type Keys = GlobalKey