#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InputSlot(usize);
impl InputSlot {
pub const fn new(index: usize) -> Self {
Self(index)
}
pub const fn index(self) -> usize {
self.0
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct InputAxisRef {
input: InputSlot,
axis: usize,
}
impl InputAxisRef {
pub const fn new(input: InputSlot, axis: usize) -> Self {
Self { input, axis }
}
pub const fn input(self) -> InputSlot {
self.input
}
pub const fn axis(self) -> usize {
self.axis
}
pub(crate) fn single(axis: usize) -> Self {
Self::new(InputSlot::new(0), axis)
}
}
impl InputAxisRef {
#[allow(clippy::type_complexity)]
pub(crate) fn model_parts(&self) -> (&InputSlot, &usize) {
(&self.input, &self.axis)
}
#[allow(clippy::type_complexity)]
pub(crate) fn from_model_parts(
parts: (InputSlot, usize),
) -> Result<Self, crate::internal::ModelError> {
let (input, axis) = parts;
let value = Self { input, axis };
Ok(value)
}
}
impl InputSlot {
#[allow(clippy::type_complexity)]
pub(crate) fn model_parts(&self) -> (&usize,) {
(&self.0,)
}
#[allow(clippy::type_complexity)]
pub(crate) fn from_model_parts(parts: (usize,)) -> Result<Self, crate::internal::ModelError> {
let (f0,) = parts;
let value = Self(f0);
Ok(value)
}
}