StreamingFormatter

Trait StreamingFormatter 

Source
pub trait StreamingFormatter {
    // Required methods
    fn format_to_writer<W: Write>(
        &self,
        repo: &Repository,
        map: &RepoMap,
        writer: &mut W,
    ) -> Result<()>;
    fn format_repo_to_writer<W: Write>(
        &self,
        repo: &Repository,
        writer: &mut W,
    ) -> Result<()>;
}
Expand description

Streaming formatter trait for low-memory output

Implement this trait to enable streaming output directly to files, stdout, or network sockets without building intermediate strings.

Required Methods§

Source

fn format_to_writer<W: Write>( &self, repo: &Repository, map: &RepoMap, writer: &mut W, ) -> Result<()>

Stream repository with map to writer

§Example
use std::io::BufWriter;
use std::fs::File;

let file = File::create("output.xml")?;
let mut writer = BufWriter::new(file);
formatter.format_to_writer(&repo, &map, &mut writer)?;
Source

fn format_repo_to_writer<W: Write>( &self, repo: &Repository, writer: &mut W, ) -> Result<()>

Stream repository only to writer

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§