Trait rstats::Printing

source ·
pub trait Printing<T>: Sized {
    // Required methods
    fn to_str(self) -> String;
    fn to_plainstr(self) -> String;

    // Provided methods
    fn rd(self) -> String { ... }
    fn gr(self) -> String { ... }
    fn bl(self) -> String { ... }
    fn yl(self) -> String { ... }
    fn mg(self) -> String { ... }
    fn cy(self) -> String { ... }
    fn wvec(self, f: &mut File) -> Result<(), Error> { ... }
    fn pvec(self) { ... }
}
Expand description

Trait to serialize tuples &(T,T) and &(T,T,T) and slices &[T], &[&[T]], &[Vec<T>]. Suitable for printing or writing to files pairs, triplets, all kinds of Vecs and slices and irregularly shaped 2D matrices.
All are converted into Strings and optionally decorated and coloured. Included are methods and constants to render the resulting String in six primary bold ANSI terminal colours.

Required Methods§

source

fn to_str(self) -> String

Method to serialize. Decorates Vecs with square brackets and tuples with round ones. Implementation code is in printing.rs.

source

fn to_plainstr(self) -> String

Method to serialize in minimal form (space separated, no brackets) Implementation code is in printing.rs.

Provided Methods§

source

fn rd(self) -> String

Printable in red

source

fn gr(self) -> String

Printable in green

source

fn bl(self) -> String

Printable in blue

source

fn yl(self) -> String

Printable in yellow

source

fn mg(self) -> String

Printable in magenta

source

fn cy(self) -> String

Printable in cyan

source

fn wvec(self, f: &mut File) -> Result<(), Error>

Method to write vector(s) to file f (space separated, without brackets). Passes up io errors

source

fn pvec(self)

Method to print vector(s) to stdout (space separated,without brackets).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Printing<T> for &[T]
where T: Display,

source§

impl<T> Printing<T> for &[&[T]]
where T: Display,

source§

fn to_plainstr(self) -> String

Without the enclosing square brackets

source§

fn to_str(self) -> String

source§

impl<T> Printing<T> for &[Vec<T>]
where T: Display,

source§

impl<T, U> Printing<T> for &(T, U)
where T: Display, U: Display,

source§

impl<T, U, V> Printing<T> for &(T, U, V)
where T: Display, U: Display, V: Display,

source§

impl<T, U, V, W> Printing<T> for &(T, U, V, W)
where T: Display, U: Display, V: Display, W: Display,

Implementors§

source§

impl<T> Printing<T> for T
where T: Display,