use std::{fmt, ops::Deref};
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OutputId(usize);
impl From<usize> for OutputId {
fn from(value: usize) -> Self {
Self(value)
}
}
impl OutputId {
pub fn offset_by(self, offset: usize) -> Self {
Self(self.0 + offset)
}
}
impl Deref for OutputId {
type Target = usize;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl fmt::Display for OutputId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl fmt::Debug for OutputId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "field{}", self.0)
}
}