microcad-export 0.4.0

µcad export API
Documentation
// Copyright © 2025-2026 The µcad authors <info@microcad.xyz>
// SPDX-License-Identifier: AGPL-3.0-or-later

//! STL exporter.

use microcad_lang::{
    builtin::{ExportError, Exporter, FileIoInterface},
    model::{Model, OutputType},
    value::Value,
};

use microcad_lang_base::Id;

/// STL Exporter.
pub struct JsonExporter;

impl Exporter for JsonExporter {
    fn export(&self, model: &Model, filename: &std::path::Path) -> Result<Value, ExportError> {
        log::debug!("Exporting model into {filename:?}");
        let mut f = std::fs::File::create(filename)?;
        log::trace!("Model to export:\n{model}");
        let _writer = std::io::BufWriter::new(&mut f);
        todo!("export json");
    }

    fn output_type(&self) -> OutputType {
        OutputType::Geometry3D
    }
}

impl FileIoInterface for JsonExporter {
    fn id(&self) -> Id {
        Id::new("json")
    }
}