Here is my code:
fn fetch_transaction (graph: &mut Vec<(&'static str, Transaction)>, tx_id: &'static str) -> Transaction {
for item in graph.iter() {
if item.0 == tx_id {
return item.1;
} else {
println!("Transaction not found.");
}
}
}
By the way, item.1 is a Transaction struct type, while item.0 is a static string. When I compile it, I get this error:
fn fetch_transaction (graph: &mut Vec<(&'static str, Transaction)>, tx_id: &'static str) -> Transaction {
| ----------- expected `Transaction` because of return type
54 | / for item in graph.iter() {
55 | | if item.0 == tx_id {
56 | | return item.1;
57 | | } else {
58 | | println!("Transaction not found.");
59 | | }
60 | | }
| |_____^ expected struct `Transaction`, found `()`
Why is this, and how can I fix it.

