pub fn statistic_from_pyobject(
py: Python<'_>,
statistic: Py<PyAny>,
) -> PyResult<Statistic>Expand description
Converts statistic into a registrable Statistic.
A built-in statistic type converts to its native Rust implementation, keeping calculation in
Rust. Any other object is wrapped as a PythonStatistic and dispatched back into Python on
calculation, including a user-defined class whose name matches a built-in.
§Errors
Returns an error if the object’s class cannot be resolved, or if a user-defined statistic has
no name attribute resolving to a non-empty string.