     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

    use super::hash::H256;
    use super::transaction::TransactionOutputScript;

    /// gettxout response
    #[derive(Debug, Serialize, Deserialize, PartialEq)]
    pub struct GetTxOutResponse {
    	/// Hash of the block this transaction output is included into.
    	/// Why it's called 'best'? Who knows
    	pub bestblock: H256,
    	/// Number of confirmations of this transaction
    	pub confirmations: u32,
    	/// Transaction value in BTC
    	pub value: f64,
    	/// Script info
    	#[serde(rename = "scriptPubKey")]
    	pub script: TransactionOutputScript,
    	/// This transaction version
    	pub version: i32,
    	/// Is this transactio a coinbase transaction?
    	pub coinbase: bool,
    }

    #[cfg(test)]
    mod tests {
    	use serde_json;
    	use super::super::bytes::Bytes;
    	use super::super::hash::H256;
    	use super::super::script::ScriptType;
    	use super::super::transaction::TransactionOutputScript;
    	use super::*;

    	#[test]
    	fn tx_out_response_serialize() {
    		let txout = GetTxOutResponse {
    			bestblock: H256::from(0x56),
    			confirmations: 777,
    			value: 100000.56,
    			script: TransactionOutputScript {
    				asm: "Hello, world!!!".to_owned(),
    				hex: Bytes::new(vec![1, 2, 3, 4]),
    				req_sigs: 777,
    				script_type: ScriptType::Multisig,
    				addresses: vec!["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa".into(), "1H5m1XzvHsjWX3wwU781ubctznEpNACrNC".into()],
    			},
    			version: 33,
    			coinbase: false,
    		};
    		assert_eq!(serde_json::to_string(&txout).unwrap(), r#"{"bestblock":"5600000000000000000000000000000000000000000000000000000000000000","confirmations":777,"value":100000.56,"scriptPubKey":{"asm":"Hello, world!!!","hex":"01020304","reqSigs":777,"type":"multisig","addresses":["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa","1H5m1XzvHsjWX3wwU781ubctznEpNACrNC"]},"version":33,"coinbase":false}"#);
    	}

    	#[test]
    	fn tx_out_response_deserialize() {
    		let txout = GetTxOutResponse {
    			bestblock: H256::from(0x56),
    			confirmations: 777,
    			value: 100000.56,
    			script: TransactionOutputScript {
    				asm: "Hello, world!!!".to_owned(),
    				hex: Bytes::new(vec![1, 2, 3, 4]),
    				req_sigs: 777,
    				script_type: ScriptType::Multisig,
    				addresses: vec!["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa".into(), "1H5m1XzvHsjWX3wwU781ubctznEpNACrNC".into()],
    			},
    			version: 33,
    			coinbase: false,
    		};
    		assert_eq!(
    			serde_json::from_str::<GetTxOutResponse>(r#"{"bestblock":"5600000000000000000000000000000000000000000000000000000000000000","confirmations":777,"value":100000.56,"scriptPubKey":{"asm":"Hello, world!!!","hex":"01020304","reqSigs":777,"type":"multisig","addresses":["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa","1H5m1XzvHsjWX3wwU781ubctznEpNACrNC"]},"version":33,"coinbase":false}"#).unwrap(),
    			txout);
    	}
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)