mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-21 21:24:41 +01:00
feat: nicer debug repr for instr id and socketidx
This commit is contained in:
parent
8b6f9810df
commit
98c9399ee4
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue