bitcoin/util/psbt/map/
mod.rs

1// Rust Bitcoin Library
2// Written by
3//   The Rust Bitcoin developers
4//
5// To the extent possible under law, the author(s) have dedicated all
6// copyright and related and neighboring rights to this software to
7// the public domain worldwide. This software is distributed without
8// any warranty.
9//
10// You should have received a copy of the CC0 Public Domain Dedication
11// along with this software.
12// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13//
14
15use std::io;
16
17use consensus::encode;
18use util::psbt;
19use util::psbt::raw;
20
21/// A trait that describes a PSBT key-value map.
22pub trait Map {
23    /// Attempt to insert a key-value pair.
24    fn insert_pair(&mut self, pair: raw::Pair) -> Result<(), encode::Error>;
25
26    /// Attempt to get all key-value pairs.
27    fn get_pairs(&self) -> Result<Vec<raw::Pair>, io::Error>;
28
29    /// Attempt to merge with another key-value map of the same type.
30    fn merge(&mut self, other: Self) -> Result<(), psbt::Error>;
31}
32
33// place at end to pick up macros
34mod global;
35mod input;
36mod output;
37
38pub use self::global::Global;
39pub use self::input::Input;
40pub use self::output::Output;