aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/export.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers/export.rs')
-rw-r--r--src/handlers/export.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/handlers/export.rs b/src/handlers/export.rs
index a0a4451..bf9dfc5 100644
--- a/src/handlers/export.rs
+++ b/src/handlers/export.rs
@@ -18,23 +18,27 @@ use std::path::PathBuf;
use crate::AppModel;
use crate::actions::ImageFormat;
use crate::dialogs;
-use crate::tr;
use crate::stages::LocalizedStageType;
+use crate::tr;
use wmap_renderer::{render_to_png, render_to_svg};
/// Exports the map to an image file in the specified format.
-pub fn export_to_file(model: &AppModel, path: PathBuf, format: ImageFormat) {
+pub fn export_to_file(model: &AppModel, path: &PathBuf, format: ImageFormat) {
let result: Result<(), String> = match format {
- ImageFormat::Png => {
- render_to_png(&model.map, &model.stage_type.to_localized(), &model.render_configuration)
- .map_err(|e| e.to_string())
- .and_then(|data| std::fs::write(&path, data).map_err(|e| e.to_string()))
- }
- ImageFormat::Svg => {
- render_to_svg(&model.map, &model.stage_type.to_localized(), &model.render_configuration)
- .map_err(|e| e.to_string())
- .and_then(|data| std::fs::write(&path, data).map_err(|e| e.to_string()))
- }
+ ImageFormat::Png => render_to_png(
+ &model.map,
+ &model.stage_type.to_localized(),
+ &model.render_configuration,
+ )
+ .map_err(|e| e.to_string())
+ .and_then(|data| std::fs::write(path, data).map_err(|e| e.to_string())),
+ ImageFormat::Svg => render_to_svg(
+ &model.map,
+ &model.stage_type.to_localized(),
+ &model.render_configuration,
+ )
+ .map_err(|e| e.to_string())
+ .and_then(|data| std::fs::write(path, data).map_err(|e| e.to_string())),
};
if let Err(error) = result {