remove O: Write constraint on pretty_print_to

This commit is contained in:
Mark 2024-06-26 21:21:44 +02:00
parent 14c8e7717d
commit d01da83866
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mers_lib" name = "mers_lib"
version = "0.8.23" version = "0.8.24"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "library to use the mers language in other projects" description = "library to use the mers language in other projects"

View File

@ -1,4 +1,4 @@
use std::{io::Write, sync::Arc}; use std::sync::Arc;
use crate::{ use crate::{
errors::CheckError, errors::CheckError,
@ -12,10 +12,11 @@ pub fn pretty_print(src: Source) {
eprintln!("{e:?}"); eprintln!("{e:?}");
std::process::exit(28); std::process::exit(28);
} }
println!();
} }
/// to print to stdout, use `pretty_print` (available only with the `ecolor-term` feature) /// to print to stdout, use `pretty_print` (available only with the `ecolor-term` feature)
pub fn pretty_print_to<O: Write>( pub fn pretty_print_to<O>(
mut src: Source, mut src: Source,
out: &mut O, out: &mut O,
theme: impl FTheme<O>, theme: impl FTheme<O>,
@ -140,7 +141,7 @@ impl ThemeGen for HtmlDefaultTheme {
pub trait FTheme<O>: ThemeGen<C = FColor, T = O> {} pub trait FTheme<O>: ThemeGen<C = FColor, T = O> {}
impl<O, T: ThemeGen<C = FColor, T = O>> FTheme<O> for T {} impl<O, T: ThemeGen<C = FColor, T = O>> FTheme<O> for T {}
fn print_parsed<O: Write>( fn print_parsed<O>(
srca: &Arc<Source>, srca: &Arc<Source>,
parsed: &dyn crate::program::parsed::MersStatement, parsed: &dyn crate::program::parsed::MersStatement,
out: &mut O, out: &mut O,
@ -158,7 +159,6 @@ fn print_parsed<O: Write>(
theme.color(&src[i..end], clr, out); theme.color(&src[i..end], clr, out);
i = end; i = end;
} }
let _ = writeln!(out);
} }
fn build_print( fn build_print(
sections: &mut Vec<(FColor, usize)>, sections: &mut Vec<(FColor, usize)>,