INNER CODE UNIT · Rust
extract_membership_id
RyanCodrai/turbovec · turbovec-python/src/lib.rs:181
fn extract_membership_id(name: &str, obj: &Bound<'_, PyAny>) -> PyResult<Option<u64>> {
if let Ok(v) = obj.extract::<u64>() {
return Ok(Some(v));
}
if is_py_int(obj) {
return Ok(None);
}
Err(pyo3::exceptions::PyTypeError::new_err(format!(
"{name} must be an integer, got {}",
type_name(obj),
)))
}
/// Map a numpy shape error from reassembling search results into a typed
/// RuntimeError. The result dimensions are derived from the core's own
/// output, so this never fires today — but a future change to result shaping
/// would otherwise surface as an uncatchable panic instead of a catchable
/// exception.