1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
crate::ix!();

/**
  | An output of a transaction. It contains
  | the public key that the next input must
  | be able to sign with to claim it.
  |
  */
#[derive(Clone,Serialize,Deserialize)]
pub struct TxOut {
    pub n_value:        Amount,
    pub script_pub_key: Script,
}

pub const DEFAULT_TX_OUT: TxOut = TxOut::new();

impl RecursiveDynamicUsage for TxOut {

    fn recursive_dynamic_usage(&self) -> usize {
        
        todo!();
            /*
                return RecursiveDynamicUsage(out.scriptPubKey);
            */
    }
}

impl Default for TxOut {
    
    fn default() -> Self {
        todo!();
        /*
            SetNull();
        */
    }
}

impl TxOut {
    pub const fn new() -> Self {
        Self {
            n_value: 0,
            script_pub_key: Script::new(),
        }
    }
}

lazy_static!{
    /*
    SERIALIZE_METHODS(CTxOut, obj) { 
        READWRITE(obj.nValue, obj.scriptPubKey); 
    }
    */
}

impl PartialEq<TxOut> for TxOut {
    
    #[inline] fn eq(&self, other: &TxOut) -> bool {
        todo!();
        /*
            return (a.nValue       == b.nValue &&
                    a.scriptPubKey == b.scriptPubKey);
        */
    }
}

impl Eq for TxOut {}

impl TxOut {
    
    pub fn set_null(&mut self)  {
        
        todo!();
        /*
            nValue = -1;
            scriptPubKey.clear();
        */
    }
    
    pub fn is_null(&self) -> bool {
        
        todo!();
        /*
            return (nValue == -1);
        */
    }
    
    pub fn new_from_amount_and_script(
        n_value_in:        &Amount,
        script_pub_key_in: Script) -> Self {
    
        todo!();
        /*


            nValue = nValueIn;
        scriptPubKey = scriptPubKeyIn;
        */
    }
    
    pub fn to_string(&self) -> String {
        
        todo!();
        /*
            return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, HexStr(scriptPubKey).substr(0, 30));
        */
    }
}