Skip to main content

render_len_checks

Function render_len_checks 

Source
pub fn render_len_checks(params: &[(String, String)]) -> Option<String>
Expand description

Emit Rust length-check guards for Vec parameters.

If two or more Vec<...> params are present, emits:

// assumes `pyo3::exceptions::PyValueError` is in scope and `a`, `b` are params
if a.len() != b.len() {
    return Err(pyo3::exceptions::PyValueError::new_err("length mismatch"));
}