gerber_types/traits.rs
1//! Traits used in gerber-types.
2
3use std::io::Write;
4
5use crate::GerberResult;
6
7/// All types that implement this trait can be converted to a complete Gerber
8/// Code line. Generated code should end with a newline.
9pub trait GerberCode<W: Write> {
10 fn serialize(&self, writer: &mut W) -> GerberResult<()>;
11}
12
13/// All types that implement this trait can be converted to a Gerber Code
14/// representation.
15///
16/// This is a crate-internal trait.
17pub trait PartialGerberCode<W: Write> {
18 fn serialize_partial(&self, writer: &mut W) -> GerberResult<()>;
19}