lichtung_plot/orchestrator/
output.rs1use std::path::Path;
4
5use crate::builder::Plot;
6use crate::{Error, Output};
7
8impl<K: crate::kind::Marker> Plot<K> {
9 pub fn svg(&self, path: impl AsRef<Path>) -> Result<Output, Error> {
13 let output = Output::new(super::render_scene(super::root::RootSource::Plot(
14 self.description(),
15 ))?);
16 output.svg(path)
17 }
18
19 pub fn svg_preserve_text(&self, path: impl AsRef<Path>) -> Result<Output, Error> {
22 let output = Output::new(super::render_scene(super::root::RootSource::Plot(
23 self.description(),
24 ))?);
25 output.svg_preserve_text(path)
26 }
27
28 pub fn png(&self, path: impl AsRef<Path>) -> Result<Output, Error> {
31 let output = Output::new(super::render_scene(super::root::RootSource::Plot(
32 self.description(),
33 ))?);
34 output.png(path)
35 }
36
37 pub fn png_preview(&self, path: impl AsRef<Path>) -> Result<Output, Error> {
40 let output = Output::new(super::render_scene(super::root::RootSource::Plot(
41 self.description(),
42 ))?);
43 output.png_preview(path)
44 }
45
46 pub fn png_with_options(
49 &self,
50 path: impl AsRef<Path>,
51 options: crate::PngOptions,
52 ) -> Result<Output, Error> {
53 let output = Output::new(super::render_scene(super::root::RootSource::Plot(
54 self.description(),
55 ))?);
56 output.png_with_options(path, options)
57 }
58}