mirror of https://codeberg.org/topola/topola.git
Derive `From` on id types
This commit is contained in:
parent
c525af7fca
commit
1b9673e3e7
|
|
@ -2,13 +2,13 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::primitives::{JointId, PolygonId, SegmentId, ViaId};
|
use crate::primitives::{JointId, PolygonId, SegmentId, ViaId};
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct ComponentId(usize);
|
pub struct ComponentId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct NetId(usize);
|
pub struct NetId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::primitives::{JointId, PolygonId, SegmentId, ViaId};
|
use crate::primitives::{JointId, PolygonId, SegmentId, ViaId};
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct PinId(usize);
|
pub struct PinId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use rstar::{AABB, primitives::Rectangle};
|
use rstar::{AABB, primitives::Rectangle};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ use crate::math::Vector2;
|
||||||
use super::{SegmentId, ViaId};
|
use super::{SegmentId, ViaId};
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct JointId(usize);
|
pub struct JointId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use rstar::{AABB, Envelope, primitives::Rectangle};
|
use rstar::{AABB, Envelope, primitives::Rectangle};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -10,7 +10,7 @@ use crate::compounds::{ComponentId, NetId, PinId};
|
||||||
use crate::math::Vector2;
|
use crate::math::Vector2;
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct PolygonId(usize);
|
pub struct PolygonId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use rstar::primitives::Rectangle;
|
use rstar::primitives::Rectangle;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ use crate::math::Vector2;
|
||||||
use super::JointId;
|
use super::JointId;
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct SegmentId(usize);
|
pub struct SegmentId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||||
|
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use rstar::{AABB, primitives::Rectangle};
|
use rstar::{AABB, primitives::Rectangle};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ use crate::math::Vector2;
|
||||||
use super::JointId;
|
use super::JointId;
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct ViaId(usize);
|
pub struct ViaId(usize);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use dearcut::{RecordingTriangulator, VertexId};
|
use dearcut::{RecordingTriangulator, VertexId};
|
||||||
use derive_getters::Getters;
|
use derive_getters::Getters;
|
||||||
use derive_more::Constructor;
|
use derive_more::{Constructor, From};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use stable_vec::StableVec;
|
use stable_vec::StableVec;
|
||||||
use undoredo::Recorder;
|
use undoredo::Recorder;
|
||||||
|
|
@ -16,7 +16,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Constructor, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
|
Clone, Constructor, Copy, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
)]
|
)]
|
||||||
pub struct MultiObstacleId {
|
pub struct MultiObstacleId {
|
||||||
layer: usize,
|
layer: usize,
|
||||||
|
|
@ -37,7 +37,9 @@ impl MultiObstacleId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Constructor, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(
|
||||||
|
Clone, Constructor, Debug, Deserialize, Eq, From, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
pub struct MultiVertexId {
|
pub struct MultiVertexId {
|
||||||
layer: usize,
|
layer: usize,
|
||||||
indices: Vec<VertexId>,
|
indices: Vec<VertexId>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue