Skip to main content

ChainReport

Trait ChainReport 

Source
pub trait ChainReport {
    // Required methods
    fn render_table(&self) -> String;
    fn print_table(&self) -> Result<(), GraphError>;
}
Expand description

Terminal tables for an option chain.

The chain renders as two box-drawn tables: one naming the symbol, the underlying price and the expiration date, then one row per strike with the columns of OPTION_CHAIN_TABLE_HEADERS and the cells of OptionData::table_cells. In colour, the headers are green, the chain’s name magenta, and the rows of strikes on a multiple of 25 points yellow.

This replaces OptionChain::show; OptionChain’s own Display is the dependency-free plain-text table.

Required Methods§

Source

fn render_table(&self) -> String

The chain’s tables as plain text, without ANSI escapes.

Source

fn print_table(&self) -> Result<(), GraphError>

Writes the chain’s tables to stdout, coloured when stdout is a terminal.

§Errors

Returns GraphError::Io when stdout cannot be written.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ChainReport for OptionChain

Implementors§