substrate/layout/
error.rs1use arcstr::ArcStr;
4use rust_decimal::Decimal;
5
6pub type LayoutResult<T> = Result<T, LayoutError>;
8
9#[derive(thiserror::Error, Debug, Clone)]
11pub enum LayoutError {
12 #[error("error during gds export: {0:?}")]
14 GdsExport(GdsExportError),
15 #[error("error specifying layout IO")]
17 IoDefinition,
18 #[error("a port had no geometry")]
20 EmptyPort,
21}
22
23impl From<GdsExportError> for LayoutError {
24 fn from(e: GdsExportError) -> Self {
25 Self::GdsExport(e)
26 }
27}
28
29pub type GdsExportResult<T> = Result<T, GdsExportError>;
31
32#[derive(thiserror::Error, Debug, Clone)]
34pub enum GdsExportError {
35 #[error("error converting an integer to the necessary type: {0:?}")]
37 TryFromInt(std::num::TryFromIntError),
38 #[error("error writing GDS file: {0:?}")]
40 Write(gds::GdsError),
41}
42
43impl From<std::num::TryFromIntError> for GdsExportError {
44 fn from(e: std::num::TryFromIntError) -> Self {
45 Self::TryFromInt(e)
46 }
47}
48
49impl From<gds::GdsError> for GdsExportError {
50 fn from(e: gds::GdsError) -> Self {
51 Self::Write(e)
52 }
53}
54
55pub type GdsImportResult<T> = Result<T, GdsImportError>;
57
58#[derive(thiserror::Error, Debug, Clone)]
60pub enum GdsImportError {
61 #[error("error converting an integer to the necessary type: {0:?}")]
63 TryFromInt(#[from] std::num::TryFromIntError),
64 #[error("error writing GDS file: {0:?}")]
66 Write(#[from] gds::GdsError),
67 #[error("cell not found in GDS library: {0}")]
69 CellNotFound(ArcStr),
70 #[error("found more than one cell with the same name in a GDS library: {0}")]
72 DuplicateCell(ArcStr),
73 #[error("unsupported GDS feature: {0}")]
75 Unsupported(ArcStr),
76 #[error("invalid GDS boundary (boundaries must start and end at the same point)")]
80 InvalidGdsBoundary,
81 #[error("GDS file units ({0}) do not match PDK units ({1})")]
83 MismatchedUnits(Decimal, Decimal),
84}