//! TODO mod impl_std_ops; pub mod serial; /// TODO #[derive(Debug, Clone, PartialEq, Eq)] pub enum Op { /// TODO NoOp(T), /// TODO Transpose(T), } impl Op { /// TODO pub fn inner_ref(&self) -> &T { self.as_ref().unwrap() } /// TODO pub fn as_ref(&self) -> Op<&T> { match self { Op::NoOp(obj) => Op::NoOp(&obj), Op::Transpose(obj) => Op::Transpose(&obj) } } /// TODO pub fn convert(self) -> Op where T: Into { self.map_same_op(T::into) } /// TODO /// TODO: Rewrite the other functions by leveraging this one pub fn map_same_op U>(self, f: F) -> Op { match self { Op::NoOp(obj) => Op::NoOp(f(obj)), Op::Transpose(obj) => Op::Transpose(f(obj)) } } /// TODO pub fn unwrap(self) -> T { match self { Op::NoOp(obj) | Op::Transpose(obj) => obj, } } } impl From for Op { fn from(obj: T) -> Self { Self::NoOp(obj) } }