I'm trying to write a function in a trait that either outputs a scalar
T or a NdArray
ArrayBase<ViewRepr<&T>, I>. I thought of the workaround using the one-to-one mapping between
ArrayBase<ViewRepr<&T>, Ix0>, but it does not work.
I know that Rust does not support function overloading. I've come across different solutions like outputting a tuple (first element being a scalar, and second being an array). Do you find this solution idiomatic in Rust? Or do you know any better workaround, more in tune with Rust spirit? My goal is to write idiomatic Rust. My current solution is to create two different traits, one implementing a function outputting a scalar and another the array.
I'm fighting for a solution since it would significantly alleviate my codebase.
Many thanks in advance