pub fn get_implementing_args<'a>(
func_name: &str,
args: &'a [Box<dyn Any>],
) -> Vec<(TypeId, &'a dyn ArrayProtocol)>Expand description
Helper function to extract all arguments implementing the ArrayProtocol trait
that also claim (via ArrayProtocol::supports_op) to support the named operation.
This is similar to NumPy’s _get_implementing_args function.
Optimized version with pre-allocated capacity and fast-path for common cases.
func_name should be the same operation name later passed to
array_function/ArrayFunction::new at the call site (e.g.
"scirs2::array_protocol::operations::subtract"). Filtering on it here
means an argument whose concrete type doesn’t implement this specific
operation is excluded from the candidate list, so callers correctly fall
through to a different implementation (or a plain-ndarray fallback)
instead of delegating to a candidate that’s guaranteed to return
NotImplemented for this particular func_name.