[][src]Function tinf::tparm

pub fn tparm(
    output: &mut dyn Write,
    capability: &[u8],
    params: &mut [Param],
    vars: &mut Vars
) -> Result<(), CapError>

Print a string capability, interpolating parameters.

tparm accepts up to 9 Params, which can be provided using the params! macro. For example, params!(1, 255, 255, 0) could represent the parameters used with initc to set color #1 to yellow.

The 'vars' argument should be the same Vars object for all strings printed to the same terminal.

Examples

Print red text, given a Desc called desc:

use tinf::cap::{setaf, sgr0};
use tinf::{tparm, Vars};

let stdout = &mut std::io::stdout();
let mut vars = Vars::new();
tparm(stdout, &desc[setaf], &mut params!(1), &mut vars)?;
stdout.write_all(b"Red text!\n");
tparm(stdout, &desc[sgr0], &mut params!(), &mut vars)?;

Errors