diff --git a/crates/ir/src/id.rs b/crates/ir/src/id.rs index 3b3f919..8f456a8 100644 --- a/crates/ir/src/id.rs +++ b/crates/ir/src/id.rs @@ -15,15 +15,23 @@ //! The distinction between [`Input`] and [`Output`] is implemented //! as them being different types. +use std::fmt; + use serde::{Deserialize, Serialize}; /// One specific instruction. /// /// It does **not** contain what kind of instruction this is. /// Refer to [`crate::instruction::Kind`] for this instead. -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct Instruction(pub(super) u64); +impl fmt::Debug for Instruction { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "InstrId {}", self.0) + } +} + /// On an **instruction**, accepts incoming data. /// /// An **instruction** cannot run if any of these are not connected. @@ -66,5 +74,11 @@ pub struct Socket { /// /// This really only serves for denoting where a socket is, /// when it's already clear which instruction is referred to. -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct SocketIdx(pub u16); + +impl fmt::Debug for SocketIdx { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } +}