INNER CODE UNIT · Rust
not_contiguous_err
RyanCodrai/turbovec · turbovec-python/src/lib.rs:14
fn not_contiguous_err(kind: &str) -> PyErr {
pyo3::exceptions::PyValueError::new_err(format!(
"{kind} must be C-contiguous; call np.ascontiguousarray(...) first",
))
}
/// Name of a Python object's type, for error messages.
fn type_name(obj: &Bound<'_, PyAny>) -> String {
obj.get_type()
.name()
.map(|n| n.to_string())
.unwrap_or_else(|_| "<unknown>".to_string())
}
/// Describe an argument for an array-mismatch error: "2-D float64" for
/// anything ndarray-like, otherwise the plain type name (e.g. "list").
fn array_desc(obj: &Bound<'_, PyAny>) -> String {
let ndim = obj