Implement OutputFormat for block in Cli and ledger-tool bigtable (#15524)

* Impl DisplayFormat for solana block

* Use DisplayFormat in ledger-tool bigtable block
This commit is contained in:
Tyera Eulberg
2021-02-24 16:14:34 -07:00
committed by GitHub
parent 7cb44b1095
commit d5f235d997
5 changed files with 156 additions and 91 deletions

View File

@@ -294,6 +294,30 @@ pub fn println_transaction(
}
}
pub fn writeln_transaction(
f: &mut dyn fmt::Write,
transaction: &Transaction,
transaction_status: &Option<UiTransactionStatusMeta>,
prefix: &str,
sigverify_status: Option<&[CliSignatureVerificationStatus]>,
) -> fmt::Result {
let mut w = Vec::new();
if write_transaction(
&mut w,
transaction,
transaction_status,
prefix,
sigverify_status,
)
.is_ok()
{
if let Ok(s) = String::from_utf8(w) {
write!(f, "{}", s)?;
}
}
Ok(())
}
/// Creates a new process bar for processing that will take an unknown amount of time
pub fn new_spinner_progress_bar() -> ProgressBar {
let progress_bar = ProgressBar::new(42);