kicad_monkey_core/
plot_document_contract.rs1use std::fmt;
4
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6pub enum PlotProjectionErrorKind {
7 ResourceLimit,
8 NumericRange,
9 InvalidModel,
10 ContractValidation,
11}
12
13#[derive(Clone, Debug, Eq, PartialEq)]
14pub struct PlotProjectionError {
15 pub kind: PlotProjectionErrorKind,
16 message: String,
17}
18
19impl PlotProjectionError {
20 pub(crate) fn new(kind: PlotProjectionErrorKind, message: impl Into<String>) -> Self {
21 Self {
22 kind,
23 message: message.into(),
24 }
25 }
26
27 pub fn message(&self) -> &str {
28 &self.message
29 }
30}
31
32impl fmt::Display for PlotProjectionError {
33 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
34 formatter.write_str(&self.message)
35 }
36}
37
38impl std::error::Error for PlotProjectionError {}
39
40#[derive(Clone, Debug, Eq, PartialEq)]
41pub struct PlotDocumentMetadata {
42 pub document_id: String,
43 pub source_path: Option<String>,
44}