Module smoldot::informant[][src]

Expand description

Information string printed out.

The so-called informant is a line of text typically printed at a regular interval on stdout.

You can make the informant overwrite itself by printing a \r at the end of it.

This code intentionally doesn’t perform any printing and only provides some helping code to make the printing straight-forward.

Usage

The InformantLine struct implements the core::fmt::Display trait.

use smoldot::informant::InformantLine;
eprint!("{}\r", InformantLine {
    enable_colors: true,
    chain_name: "My chain",
    relay_chain: None,
    max_line_width: 80,
    num_network_connections: 12,
    best_number: 220,
    finalized_number: 217,
    best_hash: &[0x12, 0x34, 0x56, 0x76],
    finalized_hash: &[0xaa, 0xbb, 0xcc, 0xdd],
    network_known_best: Some(224),
});

Structs

Implements fmt::Display and displays hashes in a nice way.

Values used to build the informant line. Implements the core::fmt::Display trait.

Extra fields if a relay chain exists.